Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensebender: power LDR on pin 7 #344

Closed
user2684 opened this issue Apr 8, 2018 · 1 comment

Comments

@user2684
Copy link
Contributor

commented Apr 8, 2018

https://forum.mysensors.org/topic/6534/nodemanager/154

setup
pinMode(7, OUTPUT); // “power pin” for Light Sensor
digitalWrite(7, LOW); // switch power off

loop
  digitalWrite(7, HIGH); // switch power on to LDR
  sendLight(forceTransmit);
  digitalWrite(7, LOW); // switch power off to LDR

and the function
/*
 * Sends Ambient Light Sensor information
 * 
 * Parameters
 * - force : Forces transmission of a value
 */

void sendLight(bool force) // Get light level
{
  if (force) lastLightLevel = -1;
  int rlightLevel =  analogRead(LIGHT_PIN);
  int lightLevel =  (analogRead(LIGHT_PIN) / 10.23) ;
  if (lightLevel != lastLightLevel) {
   gw.send(msgLight.set(lightLevel));
    lastLightLevel = lightLevel;
  }

@user2684 user2684 added the bug label Apr 8, 2018

@user2684 user2684 added this to To do in v1.8 via automation Apr 8, 2018

@user2684 user2684 moved this from Staging to Bugs in v1.8 Jul 8, 2018

@user2684 user2684 added the wontfix label Oct 2, 2018

@user2684

This comment has been minimized.

Copy link
Contributor Author

commented Oct 2, 2018

Since it won't be possible to identify if running or not on a Sensebender micro, the code cannot be easily integrated into NodeManager. Workaround is for the user to add in his own sketch the additional code/function in setup() and loop()

@user2684 user2684 closed this Oct 2, 2018

v1.8 automation moved this from Bugs to Done Oct 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
1 participant
You can’t perform that action at this time.