Pages: [1]   Go Down
Author Topic: RGB LED  (Read 699 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Eureka does not mean what you think.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!
Working with a regular Arduino for an RGB LED project. For this I chose to try out an application described on the Fritzing site and to wire it accordingly.

The code (Stated below) works properly. But it also gave me this strange remark:
Code:
Binary sketch size: 1,604 bytes (of a 14,336 byte maximum)
avrdude: stk500_getsync(): not in sync: resp=0xfe

The first one I know tells me that my sketch is using a small amount of memory of the AVR. The second is I believe a nag statement from the tool used to write it to the AVR. But what does it mean?

And this is the code used:
Code:
/*
  RGD LED
 
  Current Code
  Created by Derek Erb 22/02/2013
  Modified 22/02/2013
 
  Requirements :  1 x RGB LED
                  3 x 320 resisters
 
  0.05  ON / OFF constants
  0.04  Blinking green at the end
  0.03  DigitalWrite instead of AnalogWrite {abandoned}
  0.02  RGBOut function
  0.01  Light each colour once
*/

// Pins
const int iRed = 8;
const int iGreen = 9;
const int iBlue = 10;

// ON / OFF
const byte ON = 0;
const byte OFF = 255;

//////////////////////////////////////////////////////
//
// SETUP
//
void setup() {
 
  // Light up red first
  RGBOut(ON, OFF, OFF);
  delay(2000);
 
  // Light up green
  RGBOut(OFF, ON, OFF);
  delay(2000);
 
  // Light up blue
  RGBOut(OFF, OFF, ON);
  delay(2000);
 
  // All off
  RGBOut(OFF, OFF, OFF);
  delay(3000);
 
  // Colours
  RGBOut(ON, OFF, OFF);   // Red
  delay(1000);
  RGBOut(ON, ON, OFF);    // Yellow / Green
  delay(1000);
  RGBOut(OFF, ON, ON);    // Pale blue
  delay(1000);
  RGBOut(OFF, OFF, ON);   // Blue
  delay(1000);
  RGBOut(OFF, ON, OFF);   // Green
  delay(1000);
  RGBOut(ON, OFF, ON);    // Pink
  delay(1000);
  RGBOut(ON, ON, ON);     // White (all on)
  delay(1000);
 
  // All off
  RGBOut(OFF, OFF, OFF);
  delay(3000);

  // Blink Green 10 times
  for (int i = 0; i < 10; i++) {
    RGBOut(OFF, ON, OFF);   // Green on
    delay(200);             // 200 ms
    RGBOut(OFF, OFF, OFF);  // All off
    delay(200);             // 200 ms
  }
 
  // All off
  RGBOut(255, 255, 255);
}
 
//////////////////////////////////////////////////////
//
// LOOP
//
void loop() {
  // We'e only going to run through SETUP once
 
}

//////////////////////////////////////////////////////
//
// RGBOut
//
void RGBOut(byte bRed, byte bGreen, byte bBlue) {
  analogWrite(iRed, bRed);
  analogWrite(iGreen, bGreen);
  analogWrite(iBlue, bBlue);
}

As it happens despite what the tool is complaining about, the code works.
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 29
Posts: 1074
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
As it happens despite what the tool is complaining about, the code works.
I think you'll find that the code that is working on the Arduino is whatever was uploaded previously.  This error is from AVRdude, which is the utility used by the Arduino IDE to upload your sketch to the Arduino.  It means while the sketch compiled correctly, it did not get uploaded to the Arduino.  AVRdude is complaining it received that response from you Arduino when it was expecting another.

Googling that error specifically came up with this thread where it was caused by the Arduino pull-up resistor being incorrectly mounted, which meant the reset function wasn't reliable.

Good luck with your quest, Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 509
Posts: 31483
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This can also happen if you do not select the correct type of arduino board in the Tools menu.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Eureka does not mean what you think.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This can also happen if you do not select the correct type of arduino board in the Tools menu.

Hello!
I quite agree. I also grabbed both examples of 1.0.4 (Linux @32 bits and Windows) and promptly created an example for Slackware-13.37 for the Linux one and properly set my board style, the critter from May 2009, and the port the  USB0 one, and went ahead and built the code from above, and off I went.

I did not see the same complaint from the tool used to install the code on the board.

I am now going to go ahead and try the same sketch on this Windows computer via 1.0.4 and see what happens. I'm convinced it was just a normal jitter with regards to the tool.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Eureka does not mean what you think.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!
Update:
Both releases have been tried out. And the problem did not repeat itself. First time around the board was set correctly. Therefore there's no appropriate reason right or wrong why that happened.

Now that I know that it wants to work correctly, the next step will be to work out how to construct a sketch that allows me to send external data into a RGB display mechanism. But that's a very long time from right now.
Logged

Pages: [1]   Go Up
Jump to: