Go Down

Topic: Problems with my JeeLib library (timepass, console) (Read 780 times) previous topic - next topic


Hi! Can you please help me with my code? I attach a copy below.
I got a project when I get a value from a moisture sensor, once in 15 minutes. I wrote the values into the EEPROM memory. The Arduino will run on 4 AA batteries, so I am trying to use the lowest possible power. After a research I found these JeeLib libraries that I should use. I downloaded the library from here: https://github.com/jeelabs/jeelib
After that I used it properly, but there is one problem. I use the sleep function, but that doesn't work as it should. I know that I have to wrote it in milliseconds.  But if I write in 900000 ms which is 15 minutes, the program just skip it. With one minute, most of the time its works, but if I paste it 15 times, it's just doesn't working.

Code: [Select]

#include <RF69_compat.h>
#include <JeeLib.h>
#include <Ports.h>
#include <RF12.h>
#include <PortsBMP085.h>
#include <PortsLCD.h>
#include <PortsSHT11.h>
#include <RF69.h>
#include <RF12sio.h>
#include <RF69_avr.h>
#include <EEPROM.h>

int resval = 0;
int respin = A5;
int addr = 0;
ISR(WDT_vect) {
  Sleepy::watchdogEvent();  // Setup the watchdog

void setup() {
  Serial.println("Ready to write");

void loop() {
  resval = analogRead(respin);
  int val = (resval / 7) / 4;
  EEPROM.write(addr, val);
  Serial.print(val * 4);
  addr = addr + 1;
  if (addr == EEPROM.length()) {
    addr = 0;


I attach a screenshot of my consoole.
Another problem is that as you can see on the screenshot, after a while it just print random stuff and don't write it in a new line.

Any help appreciated. Thanks.

Go Up