Advertisement
RuiViana

Log_LDR

Oct 13th, 2016
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. unsigned int LDR = 512;
  2. float Calc1 = 0;
  3. float Calc2 = 0;
  4. float Calc3 = 0;
  5. float LogCalc = 0;
  6. //-----------------------
  7. void setup()
  8. {
  9. Serial.begin(9600);
  10. }
  11. //---------------------------------
  12. void loop()
  13. {
  14. Calc1 = map(LDR, 0, 1024 , 0, 470);
  15. Calc2 = (Calc1/470) * 10;
  16. LogCalc = log10(Calc2);
  17. Calc3 = 470 * LogCalc;
  18. Serial.println(Calc3);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement