arduino.ino 436 B

1234567891011121314151617181920
  1. #include <RCSwitch.h>
  2. RCSwitch rcSwitch = RCSwitch();
  3. void setup() {
  4. rcSwitch.enableTransmit(10);
  5. Serial.begin(9600); // == 2400 wtf???
  6. pinMode(A0, INPUT);
  7. }
  8. void loop() {
  9. unsigned int val=abs(analogRead(A0));
  10. unsigned long V=round(val * 0.006270 * 1000);
  11. Serial.println(V);
  12. Serial.println((V * 1000) << 2 | 0x00);
  13. rcSwitch.send((V * 1000) << 2 | 0x00, 24);
  14. delay(500);
  15. }
  16. // 244 = 1.53
  17. // 100 = X