adwnis123
Full Member level 4
I use this code
https://github.com/DaveBerkeley/elster_meter/blob/master/elec_meter.ino
of this project:
https://www.rotwang.co.uk/projects/meter.html
and I change it by adding
and changing the setup and loop code as below:
so that when I write PRINT on the serial to show the measurement. But it does not work. Can you help me?
https://github.com/DaveBerkeley/elster_meter/blob/master/elec_meter.ino
of this project:
https://www.rotwang.co.uk/projects/meter.html
and I change it by adding
Code:
String incomingByte; // for incoming serial data
and changing the setup and loop code as below:
Code:
void setup()
{
buff_init(& bits);
buff_init(& bytes);
pinMode(ledPin, OUTPUT);
pinMode(intPin, INPUT);
attachInterrupt(0, on_change, RISING);
Serial.begin(38400);
}
void loop()
{
incomingByte = Serial.readString();
if (incomingByte == "PRINT")
{
int byte_data = decode_bit_stream();
if (byte_data == -1)
return;
meter.on_data(byte_data);
}
}
Last edited by a moderator: