Last change
on this file since 256 was 136, checked in by ertl-honda, 9 years ago |
ライブラリとOS及びベーシックなサンプルの追加.
|
File size:
729 bytes
|
Line | |
---|
1 | /*
|
---|
2 | LCD Print
|
---|
3 |
|
---|
4 | Print the reading from a sensor to the screen.
|
---|
5 |
|
---|
6 | Circuit:
|
---|
7 | * Arduino Robot
|
---|
8 |
|
---|
9 | created 1 May 2013
|
---|
10 | by X. Yang
|
---|
11 | modified 12 May 2013
|
---|
12 | by D. Cuartielles
|
---|
13 |
|
---|
14 | This example is in the public domain
|
---|
15 | */
|
---|
16 |
|
---|
17 | #include <ArduinoRobot.h>
|
---|
18 | #include <Wire.h>
|
---|
19 | #include <SPI.h>
|
---|
20 |
|
---|
21 | int value;
|
---|
22 |
|
---|
23 | void setup() {
|
---|
24 | // initialize the robot
|
---|
25 | Robot.begin();
|
---|
26 |
|
---|
27 | // initialize the robot's screen
|
---|
28 | Robot.beginTFT();
|
---|
29 | }
|
---|
30 |
|
---|
31 | void loop() {
|
---|
32 | // read a analog port
|
---|
33 | value = Robot.analogRead(TK4);
|
---|
34 |
|
---|
35 | // write the sensor value on the screen
|
---|
36 | Robot.stroke(0, 255, 0);
|
---|
37 | Robot.textSize(1);
|
---|
38 | Robot.text(value, 0, 0);
|
---|
39 |
|
---|
40 | delay(500);
|
---|
41 |
|
---|
42 | // erase the previous text on the screen
|
---|
43 | Robot.stroke(255, 255, 255);
|
---|
44 | Robot.textSize(1);
|
---|
45 | Robot.text(value, 0, 0);
|
---|
46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.