Thursday, June 19, 2014

Hair Pulling Arduino Error

So I have been building a new controller for our 16 foot Christmas Wreath and I was running into a huge issues that I never had before.



When I tried to upload the sketch, it failed on me with this error:

avrdude: usbdev_open(): did not find any USB device

Well after an hour of searching the forum, changing COM ports, changing USB cables, still no change... It finally dawned on me that I was connecting via a 10 port USB hub, so I decided to directly connect it to my computer. Only if I would have done that an hour earlier as it totally solved my issue.

Anyway, here is my code for our wreath.

Get the code for the programmed one, visit my GitHub


/*
8CH Random Relay
Created June 2014
by Matthew Eccles

http://www.matteccles.com
*/

int relay1 = 2;
int relay2 = 3;
int relay3 = 4;
int relay4 = 5;
int relay5 = 6;
int relay6 = 7;
int relay7 = 8;
int relay8 = 9;

void setup() {
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
pinMode(relay5, OUTPUT);
pinMode(relay6, OUTPUT);
pinMode(relay7, OUTPUT);
pinMode(relay8, OUTPUT);
}

void loop() {
digitalWrite(relay1, random(2));
digitalWrite(relay2, random(2));
digitalWrite(relay3, random(2));
digitalWrite(relay4, random(2));
digitalWrite(relay5, random(2));
digitalWrite(relay6, random(2));
digitalWrite(relay7, random(2));
digitalWrite(relay8, random(2));

delay(1000);
}

No comments:

Post a Comment