Hi,
I just bought the current sensor in order to develop a solution that allows us to determine if a TV is on or not for our smart home company. I haven't been able to find any sample code that shows how to use this from a JeeNode. Can anyone point me to an example?
Thx,
Any Current Sensor sample code?
Re: Any Current Sensor sample code?
Here's some code that uses the JeeLabs calls
/* ReadAnAnalogPin
Reads an analog pin on a JeeNode and prints to the serial monitor
*/
#include <Ports.h>
#include <RF12.h> // needed to avoid a linker error
Port port (1);
void setup(){
Serial.begin(57600); // std JeeLabs serial rate
}
void loop(){
int value = port.anaRead();
Serial.println (value);
delay(100);
}
You could also just use Examples -> Basics -> AnalogReadSerial
for a quick read of an analog pin and print to the serial monitor
Port1 AIO pin = A0, Port2 AIO = A1, etc
Hope that helps,
Paul
/* ReadAnAnalogPin
Reads an analog pin on a JeeNode and prints to the serial monitor
*/
#include <Ports.h>
#include <RF12.h> // needed to avoid a linker error
Port port (1);
void setup(){
Serial.begin(57600); // std JeeLabs serial rate
}
void loop(){
int value = port.anaRead();
Serial.println (value);
delay(100);
}
You could also just use Examples -> Basics -> AnalogReadSerial
for a quick read of an analog pin and print to the serial monitor
Port1 AIO pin = A0, Port2 AIO = A1, etc
Hope that helps,
Paul
-
firestream99
- Posts: 2
- Joined: Sat Feb 16, 2013 5:39 am
Re: Any Current Sensor sample code?
Thx. That should get me going.