Pages: [1]   Go Down
Author Topic: error, and check my code? avrdude: stk500_getsync(): not in sync: resp=0x30  (Read 909 times)
0 Members and 1 Guest are viewing this topic.
Utah
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i get this error when uploading code nano 328
Code:
avrdude: stk500_getsync(): not in sync: resp=0x30
also here is the code is their any problems with it?
Code:
// Constants:
// Outputs:
const int whitePin = 13;
const int bluePin = 12;
const int redPin = 11;

// Inputs:
const int blueButton = 6;
const int redButton = 5;

// Variables:
// Read: (has something physicaly attached)
int blueState = LOW;
int redState = LOW;
// Made: (has nothing physicaly attached)
int blueCount = 0;
int redCount = 0;
int blueCountTotal = 0;
int redCountTotal = 0;

void setup() {
  Serial.begin(9600);
  // initialize the pins outputs:
  pinMode(whitePin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  pinMode(redPin, OUTPUT);
  // initialize the pins inputs:
  pinMode(blueButton, INPUT);
  pinMode(redButton, INPUT);
 
}

void loop(){
  blueState = (digitalRead, blueButton);
  redState = (digitalRead, redButton);
 
  Serial.println("Blue State: ");
  Serial.println(blueState);
  delay(700);
  Serial.println("Red State: ");
  Serial.println(redState);
  delay(700);
 
  //00000000000000000000000
  while(blueState == 1){
    blueState = (digitalRead, blueButton);
    blueCount++;
    redCount--;
    blueCountTotal++;
    if(blueCount >= 30){
      blueCount = 30;
    }
    if(blueCount <= 0){
      blueCount = 0;
    }
    if(redCount >= 30){
      redCount = 30;
    }
    if(redCount <= 0){
      redCount = 0;
    }
    analogWrite(bluePin, 1000);
    analogWrite(redPin, 1000);
    delay(1000);
    // serial debug
    Serial.println("Blue Count Total: ");
    Serial.println(blueCountTotal);
    delay(700);
    Serial.println("Red Count Total: ");
    Serial.println(redCountTotal);
    delay(700);
    Serial.println("Blue Count: ");
    Serial.println(blueCount);
    delay(700);
    Serial.println("Red Count: ");
    Serial.println(redCount);
    delay(700);
    Serial.println("Blue State: ");
    Serial.println(blueState);
    delay(700);
    Serial.println("Red State: ");
    Serial.println(redState);
    delay(700);
   
  }
  //000000000000000000000000
 
  while(redState == HIGH){
   redState = (digitalRead, redButton);
   redCount++;
   blueCount--;
   redCountTotal++;
   if(redCount >= 30){
     redCount = 30;
   }
   if(redCount <= 0){
     redCount = 0;
   }
   if(blueCount >= 30){
     blueCount = 30;
   }
   if(blueCount <= 0){
     blueCount = 0;
   }
   analogWrite(redPin, 1000);
   analogWrite(bluePin, 1000);
   delay(1000);
  }
 
 
 
 
}
i want to controll the brightnees of the leds by how long a button is pressed.
one fades, adn the other lights

also can you have negative numbers so i could change my code to the buttons adding or subtracting, and if it is negative one lights with a certain brightness(depending on how negative)
and vice versa for positive?
Logged

WV
Offline Offline
Full Member
***
Karma: 0
Posts: 160
Arduino, Helps With the ADD
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this maybe off track for your error .. but usally see the "sync" errors for om put not being set ,,, or just a simple unplug the Ardunio, close software, and start back up. Have you tryed those steps yeat smiley ?
Often wrong port seleted smiley
« Last Edit: March 16, 2012, 07:30:33 pm by woody_unreal » Logged

WV
Offline Offline
Full Member
***
Karma: 0
Posts: 160
Arduino, Helps With the ADD
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I uploaded you Sketch without error,, but i didnt breadboard the rest..... so not sure of the other problems
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When do you get the error?

When you are downloading?  Or running your sketch?
Logged

Utah
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks i found out i selected wrong board, mega i needed nano. it works.
Logged

Pages: [1]   Go Up
Jump to: