/* Copyright <2018> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ // Read data from the serial and turn ON or OFF Neopixels 0-5 depending on the value. AND turn on the other NeoPixels by default. #include #include #ifdef __AVR__ #include #endif SoftwareSerial mySerial(0, 1); // RX, TX #define pinNeop 17 // The pin on the Arduino connected to the NeoPixels for sending signals. ! #define CLOCK_PIN 13 // Clock pin #define numberLEDs 24 // Number of NeoPixels Adafruit_NeoPixel pixels = Adafruit_NeoPixel(numberLEDs, pinNeop, NEO_GRB + NEO_KHZ800); // Telling the number of LEDs, the connection pin, pixel type flags: // NEO_GRB Pixels are wired for GRB bitstream) // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs char val; // Data received from the serial port int digitalNeoPin = 17; // Set the pin to digital I/O 17 Equal to A3 int delayval = 100; // Delay for a second void setup() { pixels.begin(); // Initializing the NeoPixel library. pixels.setBrightness(10); // Value from 0 to 100% pinMode(pinNeop, OUTPUT); // Set pin as OUTPUT Serial.begin(9600); // Start serial communication at 9600 bps } void loop() { if (Serial.available()) { // If data is available to read, Serial.println("serial is available"); val = Serial.read(); // read it and store it in val } if (val == 'H') { // If H was received Serial.println("H Receive it"); //digitalWrite(pinNeop, HIGH); //for(int i=0;i