Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumWiring HardwareTroubleshooting › Uploading while Jumper is set to EXT?

Page Index Toggle Pages: 1
Uploading while Jumper is set to EXT? (Read 3302 times)
05/31/08 at 08:56:26

Titus   Offline
Full Member
Wiring Soccer Robot!
Amsterdam

Posts: 176
***
 
Dear Barragan,

I cant seem to upload a program when I power the Wiring Board with an External source.

I run a program like:

Turn led ON(pin 48),
then when I plug in my USB, the led goes off, and I can't seem to upload anything.

Code:
# define AAN_UIT_PIN 25
# define LAMPJE 48

# define MOTOR_A_PWM 0
# define MOTOR_B_PWM 1
# define MOTOR_C_PWM 2

int setupcounter=1;

void setup()
{
pinMode(AAN_UIT_PIN, INPUT);
pinMode(LAMPJE,OUTPUT);

//Turn Motor's off:
  analogWrite(MOTOR_A_PWM, 0);
  analogWrite(MOTOR_B_PWM, 0);
  analogWrite(MOTOR_C_PWM, 0);

  // Reset Variables
  int snelheid_A=0;
  int snelheid_B=0;
  int snelheid_C=0;
  setupcounter=1;
}

void loop()
  Aan_Uit();
  delayMicroseconds(1);
}

void Aan_Uit()
{
  if(digitalRead(AAN_UIT_PIN)==HIGH)//then run your program
  {
    setupcounter=0;
    digitalWrite(LAMPJE,LOW);
    Programma();
  }
  else
  {
    if (setupcounter==0)//reset him!
    {
	setup();
    }
    else
    {
	digitalWrite(LAMPJE,HIGH);
	delay(100);
    }
  }
}


void Programma()//Write your program HERE!
{

}

 



Perhaps it's a mistake in the code,
Could you take a look at the code to make sure I'm not doing anything else wrong?

The thing i wanted to work is:
In stead of reseting the wiring bord(reset button), I wanted to reset just the program by connecting a switch.
Is this the/a corract way?

Thanks,

Titus
 

Check www.TeamVossius.nl for our Autonomous soccer robots!
IP Logged
 
Reply #1 - 05/31/08 at 17:07:56

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
Yes, some errors here is a version working:

Code:
# define AAN_UIT_PIN 25
# define LAMPJE 48

# define MOTOR_A_PWM 0
# define MOTOR_B_PWM 1
# define MOTOR_C_PWM 2

int setupcounter=1;

void Programma()//Write your program HERE!
{

}


void setup()
{
  pinMode(AAN_UIT_PIN, INPUT);
  pinMode(LAMPJE,OUTPUT);

  //Turn Motor's off:
  analogWrite(MOTOR_A_PWM, 0);
  analogWrite(MOTOR_B_PWM, 0);
  analogWrite(MOTOR_C_PWM, 0);

  // Reset Variables
  int snelheid_A=0;
  int snelheid_B=0;
  int snelheid_C=0;
  setupcounter=1;
}

void loop() {
  Aan_Uit();
  delayMicroseconds(1);
}

void Aan_Uit()
{
  if(digitalRead(AAN_UIT_PIN)==HIGH)//then run your program
  {
    setupcounter=0;
    digitalWrite(LAMPJE,LOW);
    Programma();
  }
  else
  {
    if (setupcounter==0)//reset him!
    {
	setup();
    }
    else
    {
	digitalWrite(LAMPJE,HIGH);
	delay(100);
    }
  }
} 



 
IP Logged
 
Reply #2 - 06/01/08 at 05:34:51

Titus   Offline
Full Member
Wiring Soccer Robot!
Amsterdam

Posts: 176
***
 
Another explanation I though it could be:
My 9V battery was way to low(7,0V).
After that it worked, though one in a few times it didn't again..

My I ask what was wrong about my code?
I don't want to make the same mistake again.

Titus
 

Check www.TeamVossius.nl for our Autonomous soccer robots!
IP Logged
 
Page Index Toggle Pages: 1