Copyright © Parallax Inc.
Page 5 of 6
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
VAR
long RCValue
PUB Go
debug.start(31, 30, 0, 115200)
RCValue := 0
repeat
rc.rctime(0, 1, @RCValue) ' Get RC value on 0
debug.dec(RCValue / 100) ' Display results
debug.tx(13)
WaitCnt(ClkFreq / 4 + Cnt) ' Delay 250ms, repeat
Note:
This program uses the FullDuplexSerial object library, which is included with the
Propeller Tool software download. To view the results of the demonstration, after uploading is
complete run the Parallax Serial Terminal from the Run menu, or press F12. Momentarily
depress the Reset button on the Propeller QuickStart board to restart the program. Depending on
surface reflectivity, values will range from about 3 to 2000.
Arduino Uno
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(RCTime(2));
// Connect to pin 2, display results
delay(250);
// Wait 250 ms