Hey there! I’m fairly new to openframeworks and I attempt to communicate with my arduino with the visual studio c++. I have followed the steps showed in this website: "http://www.creativeapplications.net/tutorials/arduino-servo-opencv-tutorial-openframeworks/"
For your information, I am using a windows based pc. The problem is, the serial.enumerateDevices() didn’t show any devices being connected to my pc. Instead it gave me ofSerial: listing devices (0)Total in the console.
This is part of the code:
Am i doing something wrong here?
Besides that, after uploading the trossen.pde into the arduino, the arduino disconnects and connects every few seconds. This didn’t happen when i uploaded the simple blink example and i am pretty sure COM3 is the port. Please help me! Thanks in advance!
if the arduino is regularly disconnecting, that’s probably why it’s not showing up in your serial list.
i recommend uploading an example that is known to work, like blink or firmata. then check the list again. if that works, then something is wrong with trossen.pde.
Thanks for helping!
Anyway, if I were to power up 2 servos, is the voltage or current from the USB sufficient enough? I think this might be the cause for disconnections.
ah, that’s very likely the problem
it really depends on how you’ve wired up the servo, and what they’re rated for. but probably, yes, you’re drawing too much power and that’s shutting the arduino down. in general if the arduino is regularly disconnecting/restarting, you’re doing something wrong and you should immediately stop. analyze your power requirements and check your wiring for shorts, and then try again. i recommend asking on the arduino forum about wiring up servos though, they’ll be able to help better good luck!
If you’re using hobby servos, i.e. ones that draw less than 50mA they should run fine from the USB, at least that’s what I did when I was making that tutorial and the video, but a reliable way to get an Arduino to turn on and off like that is to draw too much power. If they’re bigger than that then you’ll need a separate power supply like a LiPo battery, pair of AAs, or a wall-wart that has a 4.5V or 5V out. I don’t think there’s any way to mess up the code so that it causes the Arduino to reset, but I wouldn’t put it past myself