Objects and Properties
hello,
i new programming arduino using ide , c/c++. im familiar javascript, , im trying have data object , have contain sensor values example code in javascript, object , assigning values it's properties.
is there equivalent in arduino?
how in arduino have tried following getting errors on data.property
thank community!
i new programming arduino using ide , c/c++. im familiar javascript, , im trying have data object , have contain sensor values example code in javascript, object , assigning values it's properties.
is there equivalent in arduino?
code: [select]
var data = {
sensor1,
sensor2,
sensor3
}
while(1){
data.sensor1 = analogread(1);
data.sensor2 = analogread(2);
data.sensor3 = analogread(3);
console.log(data);
wait(1000);
}
how in arduino have tried following getting errors on data.property
code: [select]
class data{
public:
float sensor1;
float sensor2;
float sensor3;
}
void setup(){
serial.begin(9600);
}
void loop(){
data.sensor1 = analogread(1);
data.sensor2 = analogread(2);
data.sensor3 = analogread(3);
serial.print(data);
delay(1000);
}
thank community!
it looks you've declared class not instances of class.
also, analog reads integers range of 0-1023, not floating points.
also, analog reads integers range of 0-1023, not floating points.
Arduino Forum > Using Arduino > Programming Questions > Objects and Properties
arduino
Comments
Post a Comment