Code help

Quick code issue ,

  1. I am trying to use one RGB led to show the state of a relay or if a sensor is under or over a set value red = triggered , green = below value not triggered, blue = no sensor connected here this code http://pastebin.com/t4S0aLxu I just can’t get it to work

  2. trying to send a SMS when the sensor is over a set value it sends SMS however it keeps sending the sms while the sensor is over set value, i just want it to send it once with a 10 min time frame

please help

if you could pastebin correction I would greatly appreciate it

IMG_20131208_122836.jpg

Marvin, [sorry you may not know me, I’m kinda new here]

Clarification please…

If I read your query and code right - the circuit and logic are basically working HOWEVER you constantly get SMS messages (one about every 20 seconds).
The loop pauses for 10 seconds if Irms is below sensorA (blue light), and for 20 seconds if above sensorC (red light).

Methinks you’ve stripped this code to its barebones as I don’t ever see the green light going on, nor the red or blue shutting off.

However, there is no test that limits sending once every 10 minutes. There is an extra brace around the gsm.SendSMS with delay section - but there is no test or other logic associated with that brace.

Is it possible there is a line or two of code missing there???

Something like:

  1. Get the current time
  2. Compare it against the last time a message was sent
  3. if delta > 10 MINUTES (600 seconds) then send the message…
  4. When a message is sent, set the last message sent time…

Do you need help with this code bit or am I just missing the whole question? (apologies if I am)

Regards,
James

Marvin,

See if this doesn’t answer the mail. As we discussed, I’ve simplified the code a little. I don’t know how you plan to send the SMS message but I’ve indicated where that could be done.

Basically, the loop starts out by turning on the lights and waiting for current draw to normalize.
Then, it tests. If no current is being drawn - all is good and keep going, pausing for the default delay time of 1 second.
If too much current is being drawn, turn the lights off and increase the delay time - the second time this happens send an alert
If it keeps happening, increase the delay time to 30 sec, 10 min, and finally 1 hour
Keep checking every hour for the condition to clear itself - once it does, send an SMS and clear the violation

Let us know how it goes - others might have suggestions as well.

Regards,
James

DelayRelayV2.ino (3.12 KB)

Thank you James for everything

Thanks Marcus and Craig

This is why I love the hive , you guys are the greatest I own you a round of Red Stripe beer

Marvin

The Tuesday Meeting Hangout is available at:

     https://plus.google.com/hangouts/_/72cpjas7eg5vgmc8srs4u5an3k?hl=en

Hi Ryan, I need to implement this for ATXHS.

We’re having a lot of trouble getting this to work correctly. How is your camera, etc set up?

We've attached a donated Samsung Chromebox to a 42" TV overlooking our meeting area. A Logitech webcam sits atop the TV. The webcam's integrated microphone has been sufficient so far, and the Chromebox is connected to the space's PA system so remote attendees may be easily heard.

I initially purchased a cheap MS 720p LifeCam HD-3000 for use with the Chromebox. This camera worked well for a few weeks, then inexplicably stopped communicating with the Chromebox one day. It was replaced with another Logitech camera we had lying around the space. I can get exact model number the next time I'm at the Hive, if that would be useful.

Given that we're using a Google appliance, setup was straightforward.

I realize this configuration is possibly somewhat rare. We had a Chromebox, and they're not terribly useful for general purpose computing. If you could be more specific about the problems you've encountered, particularly detailing which OS and Browser you're using, I could try to replicate them locally on another computer.

This helps quite a bit.

We’ve had all sorts of problems. The first probably comes from a lack of dedicated hardware for it. We’ve had to use other peoples’ laptops in the past and it’s never worked seamlessly. I’ll see about finding some “decent” hardware and an external webcam first.

hank you!