This is my Program. It's an Arduino sketch.
int bite = 0;
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
pinMode(3, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
bite = Serial.read();
if(bite != NULL){
for (int i=0; i < bite; i++){
digitalWrite(3, HIGH);
delay(1000);
digitalWrite(3, LOW);
delay(1000);
}
}
}
}
I want the code to check if there is a serial input value and whether it's neither null or a string and blink my LED the number of times as the serial value is received. My code is just blinking the light with and the light is also very dim. It just keeps running. It even happens when I send null to the serial port.