i have used jeelib in the code i have been doing..i need some help whether i have successfully used jeelib or not...thanks
#include <VirtualWire.h>
#include <JeeLib.h>
#include <Ports.h>
ISR(WDT_vect) { Sleepy::watchdogEvent(); }
int dig= 8;
int val = 0;
int digib=4;
int bat= 0;
int j=0;
void setup() {
Serial.begin(9600);
pinMode(dig,OUTPUT);
pinMode(digib,OUTPUT);
Serial.println("setup");
Serial.println("RANDOM");
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2400); // Bits per sec
vw_set_tx_pin(7);
Serial.println("RANDOM");
delay(200);
}
void loop()
{
if (j%11==0){
{
digitalWrite(dig,LOW);
delay(500);
digitalWrite(dig,HIGH);
val= analogRead(A3);
if(val>1000)
{
const char *msg2 =("ok");
vw_send((uint8_t *)msg2, strlen(msg2));
vw_wait_tx();
for(byte i=0; i<30; ++i)
Sleepy::loseSomeTime(60000);
digitalWrite(dig,LOW);
}
else
{
Serial.print(" fail ");
const char *msg = "FL";
digitalWrite(13, true); // Flash a light to show transmitting
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx();
for(byte i=0; i<30; ++i)
Sleepy::loseSomeTime(60000);
digitalWrite(dig,LOW);
}
delay(200);
}
digitalWrite(digib,HIGH);
delay(200);
bat=analogRead(A2);
if(bat>1000)
{
const char *str = " ok,";
vw_send((uint8_t *)str, strlen(str));
//Serial.print(strlen(str)); // Debug check
Serial.print(" OK , ");
vw_wait_tx(); // Wait until the whole message is gone
for(byte i=0; i<30; ++i)
Sleepy::loseSomeTime(60000);
digitalWrite(digib,LOW);
}
else
{
const char *str = "cut,";
vw_send((uint8_t *)str, strlen(str));
//Serial.print(strlen(str)); // Debug check
Serial.print(" cut ");
vw_wait_tx(); // Wait until the whole message is gone
for(byte i=0; i<30; ++i)
Sleepy::loseSomeTime(60000);
digitalWrite(digib,LOW);
}
delay(200);
}
else
j++;
}