Skip to content

Commit d49a22c

Browse files
committed
Imported legacy Robot_Motor library to new LottieLemon library
1 parent e526579 commit d49a22c

18 files changed

+767
-1012
lines changed

avr/libraries/LottieLemon/README.adoc renamed to avr/libraries/LottieLemon/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
= Robot Motor Library for Arduino =
1+
# Arduino Robot Library (codename 'Lottie Lemon')
22

3-
The Robot has a number of built in sensors and actuators. The library is designed to easily access the robot's functionality.
3+
The Robot has a number of built in sensors and actuators. The library is
4+
designed to easily access the robot's functionality.
45

5-
For more information about this library please visit us at
6-
http://www.arduino.cc/en/Reference/RobotLibrary
7-
8-
== License ==
6+
For more information about this library please visit:
7+
* https://www.arduino.cc/en/Main/Robot
8+
* https://www.arduino.cc/en/Reference/RobotLibrary
9+
* https://github.com/j54n1n/arduinorobot
910

11+
## License
12+
```
1013
Copyright (c) Arduino LLC. All right reserved.
1114
1215
This library is free software; you can redistribute it and/or
@@ -22,3 +25,4 @@ Lesser General Public License for more details.
2225
You should have received a copy of the GNU Lesser General Public
2326
License along with this library; if not, write to the Free Software
2427
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28+
```

avr/libraries/LottieLemon/examples/Robot_IR_Array_Test/Robot_IR_Array_Test.ino

Lines changed: 0 additions & 26 deletions
This file was deleted.

avr/libraries/LottieLemon/examples/Robot_Motor_Core/Robot_Motor_Core.ino

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,25 @@
77
88
*/
99

10-
#include <ArduinoRobotMotorBoard.h>
10+
#include <TwoWayIntegerEasyTransfer.h>
11+
#include <LottieLemon.h>
12+
13+
LottieLemon::MotorBoard motorBoard;
1114

1215
void setup() {
13-
RobotMotor.begin();
16+
Serial1.begin(9600);
17+
TwoWayIntegerEasyTransfer.begin(&Serial1);
18+
TwoWayIntegerEasyTransfer.attach([]() { doSystemReset(); });
19+
doSystemReset();
1420
}
21+
1522
void loop() {
16-
RobotMotor.parseCommand();
17-
RobotMotor.process();
23+
if (TwoWayIntegerEasyTransfer.hasReceivedData()) {
24+
TwoWayIntegerEasyTransfer.processInput();
25+
}
26+
motorBoard.run();
27+
}
28+
29+
void doSystemReset() {
30+
motorBoard.reset();
1831
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* Motor Board IR Array Test
2+
3+
This example of the Arduno robot's motor board returns the
4+
values read fron the 5 infrared sendors on the bottom of
5+
the robot.
6+
7+
*/
8+
9+
#include <LottieLemon.h>
10+
11+
LottieLemon::MotorBoard motorBoard;
12+
String bar; // string for storing the information
13+
14+
void setup() {
15+
// start serial communication
16+
Serial.begin(9600);
17+
// initialize the library
18+
motorBoard.begin();
19+
}
20+
21+
void loop() {
22+
bar = String(""); // empty the string
23+
// read the sensors and add them to the string
24+
bar = bar + motorBoard.IRread(1) +
25+
'\t' + motorBoard.IRread(2) +
26+
'\t' + motorBoard.IRread(3) +
27+
'\t' + motorBoard.IRread(4) +
28+
'\t' + motorBoard.IRread(5);
29+
// print out the values
30+
Serial.println(bar);
31+
delay(100);
32+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#######################################
2+
# Syntax Coloring Map for
3+
# LottieLemon
4+
#######################################
5+
6+
#######################################
7+
# Datatypes (KEYWORD1)
8+
#######################################
9+
10+
LottieLemon KEYWORD1
11+
MotorBoard KEYWORD1
12+
LineFollow KEYWORD1
13+
14+
#######################################
15+
# Methods and Functions (KEYWORD2)
16+
#######################################
17+
18+
begin KEYWORD2
19+
run KEYWORD2
20+
motorsWrite KEYWORD2
21+
IRread KEYWORD2
22+
calibIRs KEYWORD2
23+
runLineFollow KEYWORD2
24+
config KEYWORD2
25+
motorsWritePct KEYWORD2
26+
motorsStop KEYWORD2
27+
28+
#######################################
29+
# Constants (LITERAL1)
30+
#######################################
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name=Robot Motor
2-
version=1.0.2
3-
author=Arduino
4-
maintainer=Arduino <info@arduino.cc>
5-
sentence=Enables easy access to the motors of the Arduino Robot Motor board. For Arduino Robot only.
6-
paragraph=
1+
name=LottieLemon
2+
version=1.0.0
3+
author=Arduino <info@arduino.cc>, Julian Sanin <sanin89julian@gmail.com>
4+
maintainer=Julian Sanin <sanin89julian@gmail.com>
5+
sentence=Enables access to the Arduino Robot boards. For Arduino Robot only.
6+
paragraph=Supports Arduino Robot Control and Motor Board.
77
category=Device Control
8-
url=http://www.arduino.cc/en/Reference/RobotLibrary
8+
url=https://github.com/j54n1n/arduinorobot
99
architectures=avr
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
Copyright (c) 2012 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+
#ifndef LOTTIE_LEMON_H
20+
#define LOTTIE_LEMON_H
21+
22+
#include "utility/LottieLemonMotorBoard.h"
23+
24+
namespace LottieLemon {
25+
26+
//Command code
27+
enum {
28+
COMMAND_SWITCH_MODE = 0,
29+
COMMAND_RUN = 10,
30+
COMMAND_MOTORS_STOP = 11,
31+
COMMAND_ANALOG_WRITE = 20,
32+
COMMAND_DIGITAL_WRITE = 30,
33+
COMMAND_ANALOG_READ = 40,
34+
COMMAND_ANALOG_READ_RE = 41,
35+
COMMAND_DIGITAL_READ = 50,
36+
COMMAND_DIGITAL_READ_RE = 51,
37+
COMMAND_READ_IR = 60,
38+
COMMAND_READ_IR_RE = 61,
39+
COMMAND_ACTION_DONE = 70,
40+
COMMAND_READ_TRIM = 80,
41+
COMMAND_READ_TRIM_RE = 81,
42+
COMMAND_PAUSE_MODE = 90,
43+
COMMAND_LINE_FOLLOW_CONFIG = 100
44+
};
45+
46+
47+
//component codename
48+
enum {
49+
CN_LEFT_MOTOR = 0,
50+
CN_RIGHT_MOTOR = 1,
51+
CN_IR = 2
52+
};
53+
54+
//motor board modes
55+
enum {
56+
MODE_SIMPLE = 0,
57+
MODE_LINE_FOLLOW = 1,
58+
MODE_ADJUST_MOTOR = 2,
59+
MODE_IR_CONTROL = 3
60+
};
61+
62+
//bottom TKs, just for communication purpose
63+
enum {
64+
B_TK1 = 201,
65+
B_TK2 = 202,
66+
B_TK3 = 203,
67+
B_TK4 = 204
68+
};
69+
70+
/*
71+
A message structure will be:
72+
switch mode (2):
73+
byte COMMAND_SWITCH_MODE, byte mode
74+
run (5):
75+
byte COMMAND_RUN, int speedL, int speedR
76+
analogWrite (3):
77+
byte COMMAND_ANALOG_WRITE, byte codename, byte value;
78+
digitalWrite (3):
79+
byte COMMAND_DIGITAL_WRITE, byte codename, byte value;
80+
analogRead (2):
81+
byte COMMAND_ANALOG_READ, byte codename;
82+
analogRead _return_ (4):
83+
byte COMMAND_ANALOG_READ_RE, byte codename, int value;
84+
digitalRead (2):
85+
byte COMMAND_DIGITAL_READ, byte codename;
86+
digitalRead _return_ (4):
87+
byte COMMAND_DIGITAL_READ_RE, byte codename, int value;
88+
read IR (1):
89+
byte COMMAND_READ_IR;
90+
read IR _return_ (9):
91+
byte COMMAND_READ_IR_RE, int valueA, int valueB, int valueC, int valueD;
92+
93+
94+
*/
95+
}
96+
97+
#endif // LOTTIE_LEMON_H

0 commit comments

Comments
 (0)