TSGames1 3 years ago
commit
1e760ab247
1 changed files with 20 additions and 0 deletions
  1. 20 0
      arduino/arduino.ino

+ 20 - 0
arduino/arduino.ino

@@ -0,0 +1,20 @@
+#include <RCSwitch.h>
+RCSwitch rcSwitch = RCSwitch();
+
+void setup() {                
+  rcSwitch.enableTransmit(10);
+  Serial.begin(9600); // == 2400 wtf???
+  pinMode(A0, INPUT);
+}
+
+void loop() {
+  unsigned int val=abs(analogRead(A0));
+  unsigned long V=round(val * 0.006270 * 1000);
+  Serial.println(V);
+  Serial.println((V * 1000) << 2 | 0x00);
+  rcSwitch.send((V * 1000) << 2 | 0x00, 24);
+  delay(500);  
+}
+
+// 244 = 1.53
+// 100 = X