Arduino  1.8.10
ArduinoRobot.cpp
[詳解]
1 /*
2  Copyright (c) 2013 Arduino LLC. All right reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #include "ArduinoRobot.h"
20 #include "Multiplexer.h"
21 #include "Wire.h"
22 #include "EasyTransfer2.h"
23 
24 //RobotControl::RobotControl(){}
25 
26 RobotControl::RobotControl():Arduino_LCD(LCD_CS,DC_LCD,RST_LCD){
27 
28 }
29 
31  Wire.begin();
32  //Compass
33  //nothing here
34 
35  //TK sensors
36  uint8_t MuxPins[]={MUXA,MUXB,MUXC,MUXD};
37  Multiplexer::begin(MuxPins,MUX_IN,4);
38 
39  //piezo
40  pinMode(BUZZ,OUTPUT);
41 
42  //communication
43  Serial1.begin(9600);
44  messageOut.begin(&Serial1);
45  messageIn.begin(&Serial1);
46 
47  //TFT initialization
48  //Arduino_LCD::initR(INITR_GREENTAB);
49 }
50 
51 void RobotControl::setMode(uint8_t mode){
52  messageOut.writeByte(COMMAND_SWITCH_MODE);
53  messageOut.writeByte(mode);
54  messageOut.sendData();
55 }
56 
57 
#define COMMAND_SWITCH_MODE
Definition: ArduinoRobot.h:63
void pinMode(uint8_t, uint8_t)
void begin()
Definition: Wire.cpp:55
void writeByte(uint8_t dat)
RobotControl Robot
TwoWire Wire
Definition: Wire.cpp:330
#define OUTPUT
Definition: Arduino.h:44
void begin(HardwareSerial *theSerial)
void begin(uint8_t *selectors, uint8_t Z, uint8_t length)
Definition: Multiplexer.cpp:21
void setMode(uint8_t mode)