Hi, im fairly new to this and i have a question that is probably an easy fix


instead of trying yo explain able show code , tell problem...

code: [select]
int adc0 = 0;
int value;
int newvalue;
int ledpin = 13;

void setup() {
 serial.begin(9600);
 pinmode(ledpin, 1);
 value = analogread(adc0);
}

void loop() {
 newvalue = analogread(adc0);
 
 if(value == newvalue){
   digitalwrite(ledpin, 1);
   
 }else{
   digitalwrite(ledpin, 0);
   value = newvalue;
   
   serial.print("time: ");
 string values = string(value);
 string timer = string(values + "0ms");
 serial.println(timer);
 }
 delay(1000);
 
}

this code have want output the value when value has been changed problem i'm having getting starting value not reset every second when loops resets resets value not got value compare against see weather has changed.

the output i'm getting this...
time: 6820ms
time: 00ms
time: 6830ms
time: 00ms
time: 6820ms
time: 00ms
time: 6820ms
time: 00ms
time: 6820ms
time: 00ms

thanks

hi jackt96

code: [select]
int adc0 = 0;
...
value = analogread(adc0);


you measuring analog voltage on pin a0.  have connected pin?

regards

ray


Arduino Forum > Using Arduino > Programming Questions > Hi, im fairly new to this and i have a question that is probably an easy fix


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support