-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhitechnic-irrecv-test1.c
61 lines (52 loc) · 1.65 KB
/
hitechnic-irrecv-test1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma config(Sensor, S1, HTIRR, sensorI2CCustom)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/*
* $Id: hitechnic-irrecv-test1.c 133 2013-03-10 15:15:38Z xander $
*/
/**
* HTIRL-driver.h provides an API for the HiTechnic IR Receiver Sensor. This program
* demonstrates how to use the IR Receiver API to display the currently transmitted
* motor powers.
*
* Changelog:
* - 0.1: Initial release
* - 0.2: More comments
*
* Credits:
* - Big thanks to HiTechnic for providing me with the hardware necessary to write and test this.
*
* License: You may use this code as you wish, provided you give credit where it's due.
*
* THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER.
* Xander Soldaat (xander_at_botbench.com)
* 25 November 2009
* version 0.2
*/
#include "drivers/hitechnic-irrecv.h"
/*
=============================================================================
main task with some testing code
*/
task main {
sbyte _motA = 0;
sbyte _motB = 0;
nxtDisplayCenteredTextLine(0, "HiTechnic");
nxtDisplayCenteredBigTextLine(1, "IR Recv");
nxtDisplayCenteredTextLine(3, "Test 1");
nxtDisplayCenteredTextLine(5, "Connect sensor");
nxtDisplayCenteredTextLine(6, "to S1");
wait1Msec(2000);
eraseDisplay();
while (true) {
for (int i = 1; i < 5; i++) {
// Read the motor powers sent by the remote on the specified channel
// and display them.
HTIRRreadChannel(HTIRR, i, _motA, _motB);
nxtDisplayTextLine(i, "%4d, %4d", _motA, _motB);
wait1Msec(10);
}
}
}
/*
* $Id: hitechnic-irrecv-test1.c 133 2013-03-10 15:15:38Z xander $
*/