A doubt about USB connection


hey guys, first of sorry english, i'm brazilian... so,

i have little doubt usb connection...

in project, want arduino when connected in usb, , when arduino connected 127v, want other thing...
how can code little part? tried "if (serial.available() > 0)" didn't worked. code "ran", if arduino connected 127v , without usb connection...

thanks

see: http://forum.arduino.cc/index.php/topic,120693.0.html

another method connect vin analog pin (eg. a0) via voltage divider, guard against high voltage on analog input. take reading see if voltage above or below 5v. in case usb power measure 4.5v on vin, , on 8v when connected via power plug.

don't connect vin directly a0 because voltage high - use voltage divider.

quote
i tried "if (serial.available() > 0)" didn't worked.


all tells if serial data available, not if usb plugged in or not.


Arduino Forum > Using Arduino > Programming Questions > A doubt about USB connection


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support