Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Displays text sent over the serial port (e.g. from the Serial Monitor) on
- * an attached LCD.
- #include <Wire.h>
- #include <LiquidCrystal_I2C.h>
- */
- #include <SoftwareSerial.h> // 引用程式庫
- SoftwareSerial BT(9,8); // RX | TX
- const int val = 0, L_motor = 4, R_motor = 6, Monitor_val = 38400, Bt_speed = 9600;
- void setup() {
- Serial.begin(Monitor_val);
- Serial.println("Arduino Nano Ready");
- BT.begin(Bt_speed);
- pinMode(L_motor,OUTPUT);
- pinMode(R_motor,OUTPUT);
- }
- // Set the LCD address to 0x27 for a 16 chars and 2 line display
- // LiquidCrystal_I2C lcd(0x27, 16, 2);
- int getint() {
- static int p;
- int x = 0;
- while (!BT.available() || isdigit(p = BT.read()))
- x = x * 10 + p;
- return x;
- }
- String getstring(char sep = '\n') {
- static char p;
- String x;
- while (!BT.available() || (p = BT.read()) != sep)
- x += p;
- return x;
- }
- void loop() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement