/* Send data throuhg a NeoPixel stripe at the end of the neopix stript you can connect the Arduino Nano as a receiver for the data string. 21.11.2021 chris_ */ #include #ifdef __AVR__ #include #endif #define PIN 6 #define NUMPIXELS 12 // NUMPIXEL increase by 1 because last pixel is the data transmission message Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS + 1, PIN, NEO_GRB + NEO_KHZ800); void setup() { pixels.begin(); } char Message[]="c-hater ist der Beste ! \n"; void sendBit(uint8_t bitValue) { const uint8_t dataPos = NUMPIXELS; uint32_t data; boolean val = (bitValue & 1) != 0; if ( val) data = 0xFFFFFF; else data = 0; pixels.setPixelColor(NUMPIXELS, data); pixels.show(); //Serial.print(val);Serial.print(" "); delay(50); } void sendByte(uint8_t value) { //Serial.println(); // startbit sendBit(1); sendBit(value >> 0); sendBit(value >> 1); sendBit(value >> 2); sendBit(value >> 3); sendBit(value >> 4); sendBit(value >> 5); sendBit(value >> 6); sendBit(value >> 7); // stop bits sendBit(0); sendBit(0); sendBit(0); sendBit(0); sendBit(0); sendBit(0); sendBit(0); sendBit(0); } void loop() { static uint8_t ledPos = 0; static uint8_t idx = 0; static uint8_t counter = 0; for (int n = 0; n < NUMPIXELS; n++) { if (ledPos == n) pixels.setPixelColor(n, pixels.Color(0, 150, 0)); else pixels.setPixelColor(n, pixels.Color(0, 0, 0)); } sendByte(Message[counter++]); if(counter>=sizeof(Message))counter=0; // NeoPixel Lauflicht ledPos++; if (ledPos >= NUMPIXELS)ledPos = 0; }