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

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -