Pages: [1]   Go Down
Author Topic: Virtual Breadboard VBB3 Analog Input Problem?  (Read 2683 times)
0 Members and 1 Guest are viewing this topic.
Leverkusen Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Community,
I am a total Newbe and just now ordered my first Arduino Uno.
Since I hardly can wait for it to arrive, I searched for a virtual Arduino application and found it in VBB3.
My first virtual setup includes 5 Analog Inputs, and here is were my Problem starts.
It seems that VBB3 only registers the input voltage at Analog pin 0, no matter which pin I monitor it always gives me the voltage of pin 0.
Did someone had a similiar problem? And is there a workaround?

Greetings

Marco..

Logged

Kortrijk, Belgium
Offline Offline
Full Member
***
Karma: 1
Posts: 151
Young geek
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe post your code so we can help you...
Logged

Sorry God members, I'm an atheist.

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

Certainly I can post some code I used....

Quote
const int JOYPIN_X = A0;
const int JOYPIN_Y = A1;
const int JOYPIN_Z = A2;
const int STEERPIN = A3;
const int GASPIN = A4;
const int POSRESET = 12;
const int ENGINEKILL = 9;

// Define Outputs
const int STEERMOTPOS = 11;
const int STEERMOTNEG = 10;
const int GASMOTPOS = 6;
const int GASMOTNEG = 5;
const int FRONTPROPPOS = 8;
const int FRONTPROPNEG = 7;
const int KILLSWITCH = 4;
// Define Thresholds
const int X_TOL = 10;
const int Y_TOL = 10;
const int Z_TOL = 510;

void setup()
{
  Serial.begin(9600);
  pinMode(STEERMOTPOS, OUTPUT);
  pinMode(STEERMOTNEG, OUTPUT);
  pinMode(GASMOTPOS, OUTPUT);
  pinMode(GASMOTNEG, OUTPUT);
  pinMode(FRONTPROPPOS, OUTPUT);
  pinMode(FRONTPROPNEG, OUTPUT);
  pinMode(KILLSWITCH, OUTPUT);
  pinMode(POSRESET, INPUT);
  pinMode(ENGINEKILL, INPUT);
  digitalWrite(POSRESET, HIGH);
  digitalWrite(ENGINEKILL, HIGH);
}
void loop()
{
  //Get Input Values
  int JOYXNOW = analogRead(JOYPIN_X);
  int JOYYNOW = analogRead(JOYPIN_Y);
  int JOYZNOW = analogRead(JOYPIN_Z);
  int STEERNOW = analogRead(STEERPIN);
  int GASNOW = analogRead(GASPIN);
    
  
  //Compare Values   
    if (JOYXNOW + X_TOL <= STEERNOW) {
    Serial.println("LEFT");
 } else if (JOYXNOW - X_TOL >= STEERNOW) {
    Serial.println("RIGHT");
 }
}

Logged

Pages: [1]   Go Up
Jump to: