Created
May 31, 2014 14:15
-
-
Save takano32/18fc571f823d5236b09f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <RCS620S.h> | |
#include <inttypes.h> | |
#include <string.h> | |
#define COMMAND_TIMEOUT 400 | |
#define PUSH_TIMEOUT 2100 | |
#define POLLING_INTERVAL 500 | |
#define LED_PIN 13 | |
RCS620S rcs620s; | |
void setup() { | |
int ret; | |
// Serial.println("Setup..."); | |
pinMode(LED_PIN, OUTPUT); // for Polling Status | |
digitalWrite(LED_PIN, LOW); | |
Serial.begin(115200); // for RC-S620/S | |
// initialize RC-S620/S | |
ret = rcs620s.initDevice(); | |
while (!ret) {} // blocking | |
} | |
void loop() { | |
int ret, i; | |
// Polling | |
digitalWrite(LED_PIN, HIGH); | |
rcs620s.timeout = COMMAND_TIMEOUT; | |
ret = rcs620s.polling(); | |
if(ret) { | |
delay(3000); | |
// Serial.print("IDm:"); | |
for (i = 0; i < 8; i++) { | |
// if(rcs620s.idm[i] / 0x10 == 0) Serial.print(0); | |
// Serial.print(rcs620s.idm[i], HEX); | |
} | |
} else { | |
// println("Polling..."); | |
} | |
rcs620s.rfOff(); | |
digitalWrite(LED_PIN, LOW); | |
delay(POLLING_INTERVAL); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment