Clearing Arduino's serial buffer -



Clearing Arduino's serial buffer -

i have simple arduino code:

void loop() { if serial.available { c = serial.read(); if (c == 'a') { blinkled(); } else offled(); } }

it should glow led if send character 'a'. , shld go off when dont give when loop goes next itration.

but 1 time give 'a'. starts glowing , never goes off.

is reading char 'a' buffer? if how clear ?

serial.flush() not working.

any ideas please. new arduino. sorry if silly.

you have set offled function within serial.available() path. turn off serial.available() beingness true , pushing different character reads other 'a'

unfortunately illustration above makes same mistake.

construct led turns off outside if statement

arduino

Comments

Popular posts from this blog

php - How to pass multiple values from url -

php - Laravel not returning controller -

c# - Confused on how to specify a Platform and Version while using ChromeOptions for RemoteWebDriver with Selenium donNet since recent updates -