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
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.
all tells if serial data available, not if usb plugged in or not.
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
Post a Comment