-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from oroca/develop
merge from develop
- Loading branch information
Showing
34 changed files
with
3,747 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
"vector": "cpp", | ||
"xhash": "cpp", | ||
"xstring": "cpp", | ||
"xutility": "cpp" | ||
"xutility": "cpp", | ||
"iosfwd": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ | |
https://blog.naver.com/chcbaram/221416603068 | ||
*/ | ||
|
||
EduBot edubot; | ||
|
||
|
||
|
||
void setup() { | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include <EduBot.h> | ||
|
||
|
||
extern void scratch_setup(); | ||
extern void scratch_loop(); | ||
extern void linetrace_setup(); | ||
extern void linetrace_loop(); | ||
extern void stepmotor_setup(); | ||
extern void stepmotor_loop(); | ||
extern void getacc_setup(); | ||
extern void getacc_loop(); | ||
extern void getgyro_setup(); | ||
extern void getgyro_loop(); | ||
extern void getrpy_setup(); | ||
extern void getrpy_loop(); | ||
extern void tof_setup(); | ||
extern void tof_loop(); | ||
extern void audio_setup(); | ||
extern void audio_loop(); | ||
extern void neopixel_setup(); | ||
extern void neopixel_loop(); | ||
|
||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
edubot.begin(115200); | ||
|
||
edubot.menuAdd("스크래치 3.0", scratch_setup, scratch_loop); | ||
edubot.menuAdd("LineTrace", linetrace_setup, linetrace_loop); | ||
edubot.menuAdd("StepMotor", stepmotor_setup, stepmotor_loop); | ||
edubot.menuAdd("GetAcc", getacc_setup, getacc_loop); | ||
edubot.menuAdd("GetGyro", getgyro_setup, getgyro_loop); | ||
edubot.menuAdd("GetRPY", getrpy_setup, getrpy_loop); | ||
edubot.menuAdd("ToF", tof_setup, tof_loop); | ||
edubot.menuAdd("Audio", audio_setup, audio_loop); | ||
edubot.menuAdd("NeoPixel", neopixel_setup, neopixel_loop); | ||
} | ||
|
||
void loop() { | ||
// put your main code here, to run repeatedly: | ||
edubot.menuUpdate(); | ||
} | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <EduBot.h> | ||
|
||
|
||
|
||
|
||
void getacc_setup() { | ||
// put your setup code here, to run once: | ||
edubot.begin(115200); | ||
} | ||
|
||
void getacc_loop() { | ||
// put your main code here, to run repeatedly: | ||
static uint32_t pre_time; | ||
|
||
|
||
if (millis()-pre_time >= 50) | ||
{ | ||
pre_time = millis(); | ||
|
||
edubot.lcd.clearDisplay(); | ||
edubot.lcd.printf(16*0, 16*0, "aX : %f",edubot.imu.getAccX()); | ||
edubot.lcd.printf(16*0, 16*1, "aY : %f",edubot.imu.getAccY()); | ||
edubot.lcd.printf(16*0, 16*2, "aZ : %f",edubot.imu.getAccZ()); | ||
edubot.lcd.display(); | ||
|
||
Serial.print("aX : "); | ||
Serial.print(edubot.imu.getAccX()); | ||
Serial.print("\taY : "); | ||
Serial.print(edubot.imu.getAccY()); | ||
|
||
Serial.print("\taZ : "); | ||
Serial.print(edubot.imu.getAccZ()); | ||
Serial.println(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <EduBot.h> | ||
|
||
|
||
|
||
void getgyro_setup() { | ||
// put your setup code here, to run once: | ||
edubot.begin(115200); | ||
} | ||
|
||
void getgyro_loop() { | ||
// put your main code here, to run repeatedly: | ||
static uint32_t pre_time; | ||
|
||
|
||
if (millis()-pre_time >= 50) | ||
{ | ||
pre_time = millis(); | ||
|
||
edubot.lcd.clearDisplay(); | ||
edubot.lcd.printf(16*0, 16*0, "gX : %f",edubot.imu.getGyroX()); | ||
edubot.lcd.printf(16*0, 16*1, "gY : %f",edubot.imu.getGyroY()); | ||
edubot.lcd.printf(16*0, 16*2, "gZ : %f",edubot.imu.getGyroZ()); | ||
edubot.lcd.display(); | ||
|
||
Serial.print("gX : "); | ||
Serial.print(edubot.imu.getGyroX()); | ||
Serial.print("\tgY : "); | ||
Serial.print(edubot.imu.getGyroY()); | ||
|
||
Serial.print("\tgZ : "); | ||
Serial.print(edubot.imu.getGyroZ()); | ||
Serial.println(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <EduBot.h> | ||
|
||
|
||
|
||
|
||
void getrpy_setup() { | ||
// put your setup code here, to run once: | ||
edubot.begin(115200); | ||
} | ||
|
||
void getrpy_loop() { | ||
// put your main code here, to run repeatedly: | ||
static uint32_t pre_time; | ||
|
||
if (millis()-pre_time >= 50) | ||
{ | ||
pre_time = millis(); | ||
|
||
edubot.lcd.clearDisplay(); | ||
edubot.lcd.printf(16*0, 16*0, "R : %f",edubot.imu.getRoll()); | ||
edubot.lcd.printf(16*0, 16*1, "P : %f",edubot.imu.getPitch()); | ||
edubot.lcd.printf(16*0, 16*2, "Y : %f",edubot.imu.getYaw()); | ||
edubot.lcd.display(); | ||
|
||
Serial.print("R : "); | ||
Serial.print(edubot.imu.getRoll()); | ||
Serial.print("\tP : "); | ||
Serial.print(edubot.imu.getPitch()); | ||
|
||
Serial.print("\tY : "); | ||
Serial.print(edubot.imu.getYaw()); | ||
Serial.println(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#include <EduBot.h> | ||
|
||
|
||
|
||
|
||
static int step_speed = 90; | ||
|
||
void linetrace_setup() { | ||
// put your setup code here, to run once: | ||
|
||
edubot.begin(115200); | ||
} | ||
|
||
void linetrace_loop() { | ||
// put your main code here, to run repeatedly | ||
int x = 0; | ||
int y = 0; | ||
int sen[4]; | ||
static uint8_t mode = 0; | ||
static int line_pos = 0; | ||
|
||
|
||
edubot.lcd.clearDisplay(); | ||
|
||
|
||
sen[0] = edubot.floor_sensor.getRightOut(); | ||
sen[1] = edubot.floor_sensor.getRightIn(); | ||
sen[2] = edubot.floor_sensor.getLeftIn(); | ||
sen[3] = edubot.floor_sensor.getLeftOut(); | ||
|
||
|
||
if (mode == 0) | ||
{ | ||
edubot.lcd.printf(0, 16*0, "%d", sen[0]); | ||
edubot.lcd.printf(0, 16*1, "%d", sen[1]); | ||
edubot.lcd.printf(0, 16*2, "%d", sen[2]); | ||
edubot.lcd.printf(0, 16*3, "%d", sen[3]); | ||
} | ||
else if (mode == 1) | ||
{ | ||
for (int i=0; i<4; i++) | ||
{ | ||
sen[i] = map(sen[i], 0, 255, 1, 60); | ||
edubot.lcd.fillRect(11 + 32*i, 64-sen[i], 10, sen[i], WHITE); | ||
} | ||
|
||
line_pos = (sen[1]-sen[2])/1; | ||
|
||
edubot.lcd.fillRect(64- 5 + line_pos, 4, 10, 4, WHITE); | ||
|
||
|
||
int left_speed; | ||
int right_speed; | ||
|
||
left_speed = step_speed - line_pos*2; | ||
right_speed = step_speed + line_pos*2; | ||
|
||
if ( sen[1] < 2 && sen[2] < 2) | ||
{ | ||
left_speed = 0; | ||
right_speed = 0; | ||
} | ||
|
||
edubot.led.leftBright(0, sen[2], 0); | ||
edubot.led.rightBright(0, sen[1], 0); | ||
|
||
if (edubot.tof_L.distance_mm < 60 || edubot.tof_R.distance_mm < 80) | ||
{ | ||
left_speed = 0; | ||
right_speed = 0; | ||
} | ||
edubot.motor.setSpeed(left_speed, right_speed); | ||
|
||
} | ||
else | ||
{ | ||
edubot.motor.setSpeed(0, 0); | ||
edubot.lcd.printf(0, 0 , "L %d mm", edubot.tof_L.distance_mm); | ||
edubot.lcd.printf(0, 16, "R %d mm", edubot.tof_R.distance_mm); | ||
} | ||
edubot.lcd.display(); | ||
|
||
delay(1); | ||
|
||
if (edubot.buttonGetPressed() == true) | ||
{ | ||
while(edubot.buttonGetPressed() == true); | ||
|
||
mode++; | ||
mode %= 3; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include <EduBot.h> | ||
|
||
|
||
|
||
|
||
|
||
void neopixel_setup() { | ||
// put your setup code here, to run once: | ||
|
||
edubot.begin(115200); | ||
|
||
} | ||
|
||
void neopixel_loop() { | ||
// put your main code here, to run repeatedly | ||
static uint8_t led_bright = 0; | ||
static int led_dir = 1; | ||
static int led_index = 0; | ||
|
||
|
||
edubot.lcd.clearDisplay(); | ||
|
||
if (led_index == 0) | ||
{ | ||
edubot.led.leftBright(led_bright, 0, 0); | ||
edubot.led.rightBright(led_bright, 0, 0); | ||
|
||
edubot.lcd.printf(16*0, 16*0, "빨간색 : %d", led_bright); | ||
} | ||
else if(led_index == 1) | ||
{ | ||
edubot.led.leftBright(0, led_bright, 0); | ||
edubot.led.rightBright(0, led_bright, 0); | ||
edubot.lcd.printf(16*0, 16*0, "그린색 : %d", led_bright); | ||
} | ||
else | ||
{ | ||
edubot.led.leftBright(0, 0, led_bright); | ||
edubot.led.rightBright(0, 0, led_bright); | ||
edubot.lcd.printf(16*0, 16*0, "파란색 : %d", led_bright); | ||
} | ||
edubot.lcd.display(); | ||
|
||
led_bright += led_dir; | ||
|
||
if (led_bright == 255) | ||
{ | ||
led_dir = -1; | ||
} | ||
if (led_bright == 0) | ||
{ | ||
led_dir = 1; | ||
led_index++; | ||
led_index %= 3; | ||
} | ||
delay(2); | ||
} |
Oops, something went wrong.