Code Snippets

  1. Basic 1 Wire Read Temp
  2. Basic BMP180
  3. Getting 1 Wire Device Address's
  4. GSM signal tester
  5. Multi 1 wire by device address
  6. SMS Sender
  7. Software Serial Mode Set
  8. Wifi Signal Tester
  9. UVM30A Analogue Sensor
  10. Tipping Bucket Rain with Light (Current WIP)
  11. Another way to Count

Another way to Count

Using a Hall effect sensor again ...

#define RainPin 5

//Rain variable
bool RainHigh=false;
const float LowAmt=5.0//when rain is low, takes this ml to trip
const float HiAmt=5.0;    //when rain is high, takes this ml to trip
float RainAccum=0.0;     //Rain accumulator since start of sample

void setup(void) {
   // Rain get start state
   if (digitalRead(RainPin)==HIGH)

//In setup, I determine if the RainPin is high or low. This just determines which bucket is up and the starting point to start counting tips of the bucket.

void loop(void)

// Rain calculator, looks for Rain continuously
// Look for low to high
if ((RainHigh==false)&&(digitalRead(RainPin)==HIGH))
if ((RainHigh==true)&&(digitalRead(RainPin)==LOW))