Pages: [1]   Go Down
Author Topic: Visual Basic 2005: Reset  (Read 361 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello guys,

I managed to get a connection between my Arduino Diecimila and Visual Basic 2005. I use 3 push buttons to send data to Visual Basic, that was no problem. Now I need something how to reset my board, I made this Arduino code:

Code:
int inPin5 = 3;
int inPin6 = 5;
int inPin7 = 7;

int val5    = 0;
int val6    = 0;
int val7    = 0;

int delay5  = 0;
int delay6  = 0;
int delay7  = 0;

void setup() {
  pinMode(inPin5, INPUT);
  pinMode(inPin6, INPUT);
  pinMode(inPin7, INPUT);
  
  Serial.begin(9600);
}

void loop() {
  val5 = digitalRead(inPin5);
  val6 = digitalRead(inPin6);
  val7 = digitalRead(inPin7);
  
  if (val5 == HIGH) {
     if (delay5 == 0) {
       Serial.println("Gat5");
       delay5++;
     }
  }
  if (val6 == HIGH) {
     if (delay6 == 0) {
       Serial.println("Gat6");
       delay6++;
     }
  }
  if (val7 == HIGH) {
     if (delay7 == 0) {
       Serial.println("Gat7");
       delay7++;
     }
  }
}

void reset() {
  delay5  = 0;
  delay6  = 0;
  delay7  = 0;  
}

I can send data to my Arduino, but how can I execute the function: reset(); ? What do I have to send to my Arduino ?

Thanks,
Jesper
Logged

Copenhagen / Denmark
Offline Offline
Edison Member
*
Karma: 6
Posts: 2360
Do it !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If i understand your post correctly, you want to send something from your VB program that will make your Arduino program's reset() function run ?

You can't directly control Arduini code from the VB program. But you can send for instance a single char. like "R"
 and then in the main loop in your Arduino program use the serialavailable() function to check if data is present in the input buffer. If data is ready read it and check if it is "R"and then call your Reset() function.

Hope this makes sense
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yep check out the "physical pixel" example code - it's built right into the Arduino IDE!

Of course you wont use the processing code to send data to your arduino, but rather write your own VB code. the example arduino code should be what you are looking for though.
Logged

Pages: [1]   Go Up
Jump to: