User Manual

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
62
#include <pololu/orangutan.h>
/*
* svp1: for the Orangutan SVP.
*
* This example uses the OrangutanSVP functions to set the mode of the
* auxiliary processor, take analog readings on line D/RX, and display
* information about the Orangutan's current USB device state on the LCD.
*
* http://www.pololu.com/docs/0J20
* http://www.pololu.com
* http://forum.pololu.com
*/
int main()
{
// Make SSbar be an output so it does not interfere with SPI communication.
set_digital_output(IO_B4, LOW);
// Set the mode to SVP_MODE_ANALOG so we can get analog readings on line D/RX.
svp_set_mode(SVP_MODE_ANALOG);
while(1)
{
clear(); // Erase the LCD.
if (usb_configured())
{
// Connected to USB and the computer recognizes the device.
print("USB");
}
else if (usb_power_present())
{
// Connected to USB.
print("usb");
}
if (usb_suspend())
{
// Connected to USB, in the Suspend state.
lcd_goto_xy(4,0);
print("SUS");
}
if (dtr_enabled())
{
// The DTR virtual handshaking line is 1.
// This often means that a terminal program is conencted to the
// Pololu Orangutan SVP USB Communication Port.
lcd_goto_xy(8,0);
print("DTR");
}
if (rts_enabled())
{
// The RTS virtual handshaking line is 1.
lcd_goto_xy(12,0);
print("RTS");
}
// Display an analog reading from channel D, in millivolts.
lcd_goto_xy(0,1);
?
Pololu AVR C/C++ Library User’s Guide © 2001–2019 Pololu Corporation
3. Functional Overview and Example programs Page 44 of 56