I have a plan to run a void function in the arduino from the control of MIT App through Bluetooth the problem is the value that printed cannot calling out the void function and there is a problem with the Serial.read();
#include <SoftwareSerial.h>
#include <Adafruit_NeoPixel.h>
#define rxPin 8
#define txPin 7
Adafruit_NeoPixel strip = Adafruit_NeoPixel (12,3,NEO_RGB + NEO_KHZ800);
SoftwareSerial mySerial(rxPin, txPin); // RX, TX
char myChar ;
void setup() {
Serial.begin(9600);
Serial.println("Goodnight moon!");
mySerial.begin(9600);
mySerial.println("Hello, world?");
pinMode(13, OUTPUT);
}
void loop(){
while(mySerial.available()){
myChar = mySerial.read();
Serial.print(myChar);
}
while(Serial.available()){
myChar = Serial.read();
mySerial.print(myChar);
}
}
void ani1(){
for(int c=0;c<12;c++){
strip.setPixelColor(c,strip.Color(255,0,0));
Serial.print(c);
strip.show();
delay(100);
}
}
void ani2(){
for(int c=11;c>=0;c--){
strip.setPixelColor(c,strip.Color(255,0,0));
Serial.print(c);
strip.show();
delay(100);
}
}
And there is my apps
Please the guidance