arduino stuffs
36 files changed, 131 insertions, 1398 deletions
diff --git a/.DS_Store b/.DS_Store Binary files differdeleted file mode 100644 index 65dab6c..0000000 --- a/.DS_Store +++ /dev/null diff --git a/ardu_robot/.DS_Store b/ardu_robot/.DS_Store Binary files differdeleted file mode 100644 index 5008ddf..0000000 --- a/ardu_robot/.DS_Store +++ /dev/null diff --git a/ardu_robot/IrSensors.ino b/ardu_robot/IrSensors.ino deleted file mode 100644 index 5b3ee76..0000000 --- a/ardu_robot/IrSensors.ino +++ /dev/null @@ -1,63 +0,0 @@ - -/**************************** - ir reflectance sensor code -****************************/ - -const byte NBR_SENSORS = 3; // this version only has left and right sensors -const byte IR_SENSOR[NBR_SENSORS] = {0, 1, 2}; // analog pins for sensors - -int irSensorAmbient[NBR_SENSORS]; // sensor value with no reflection -int irSensorReflect[NBR_SENSORS]; // value considered detecting an object -int irSensorEdge[NBR_SENSORS]; // value considered detecting an edge -boolean isDetected[NBR_SENSORS] = {false,false}; // set true if object detected - -const int irReflectThreshold = 10; // % level below ambient to trigger reflection -const int irEdgeThreshold = 90; // % level above ambient to trigger edge - -void irSensorBegin() -{ - for(int sensor = 0; sensor < NBR_SENSORS; sensor++) - irSensorCalibrate(sensor); -} - -// calibrate for ambient light -void irSensorCalibrate(byte sensor) -{ - int ambient = analogRead(IR_SENSOR[sensor]); // get ambient level - irSensorAmbient[sensor] = ambient; - // precalculate the levels for object and edge detection - irSensorReflect[sensor] = (ambient * (long)(100-irReflectThreshold)) / 100; - irSensorEdge[sensor] = (ambient * (long)(100+irEdgeThreshold)) / 100; -} - -// returns true if an object reflection detected on the given sensor -// the sensor parameter is the index into the sensor array -boolean irSensorDetect(int sensor) -{ - boolean result = false; // default value - int value = analogRead(IR_SENSOR[sensor]); // get IR light level - if( value <= irSensorReflect[sensor]) { - result = true; // object detected (lower value means more reflection) - if( isDetected[sensor] == false) { // only print on initial detection - Serial.print(locationString[sensor]); - Serial.println(" object detected"); - } - } - isDetected[sensor] = result; - return result; -} - -boolean irEdgeDetect(int sensor) -{ - boolean result = false; // default value - int value = analogRead(IR_SENSOR[sensor]); // get IR light level - if( value >= irSensorEdge[sensor]) { - result = true; // edge detected (higher value means less reflection) - if( isDetected[sensor] == false) { // only print on initial detection - Serial.print(locationString[sensor]); - Serial.println(" edge detected"); - } - } - isDetected[sensor] = result; - return result; -} diff --git a/ardu_robot/ardu_robot.ino b/ardu_robot/ardu_robot.ino deleted file mode 100644 index 1409fa1..0000000 --- a/ardu_robot/ardu_robot.ino +++ /dev/null @@ -1,134 +0,0 @@ -/********************************************************** -MyRobot.ino - -Initial sketch structured using tabs - -Michael Margolis 4 July 2012 -***********************************************************/ - -#include <AFMotor.h> // adafruit motor shield library -#include "RobotMotor.h" // 2wd or 4wd motor library - -#include "globalDefines.h" // global defines - -// Setup runs at startup and is used configure pins and init system variables -void setup() -{ - Serial.begin(9600); - blinkNumber(8); // open port while flashing. Needed for Leonardo only - - motorBegin(MOTOR_LEFT); - motorBegin(MOTOR_RIGHT); - - irSensorBegin(); // initialize sensors - pinMode(LED_PIN, OUTPUT); // enable the LED pin for output - - Serial.println("Waiting for a sensor to detect blocked reflection"); -} - -void loop() -{ - // call a function when reflection blocked on left side - if(lookForObstacle(OBST_LEFT_EDGE) == true) { - calibrateRotationRate(DIR_LEFT,360); // calibrate ccw rotation - } - // as above for right sensor - if(lookForObstacle(OBST_RIGHT_EDGE) == true) { - calibrateRotationRate(DIR_RIGHT, 360); // calibrate CW rotation - } -} - -// function to indicate numbers by flashing the built-in LED -void blinkNumber( byte number) { - pinMode(LED_PIN, OUTPUT); // enable the LED pin for output - while(number--) { - digitalWrite(LED_PIN, HIGH); delay(100); - digitalWrite(LED_PIN, LOW); delay(400); - } -} - -/********************** - code to look for obstacles -**********************/ - -// returns true if the given obstacle is detected -boolean lookForObstacle(int obstacle) -{ - switch(obstacle) { - case OBST_FRONT_EDGE: return irEdgeDetect(DIR_LEFT) || - irEdgeDetect(DIR_RIGHT); - case OBST_LEFT_EDGE: return irEdgeDetect(DIR_LEFT); - case OBST_RIGHT_EDGE: return irEdgeDetect(DIR_RIGHT); - } - return false; -} - -/************************************* - functions to rotate the robot -*************************************/ - -// return the time in milliseconds to turn the given angle at the given speed -long rotationAngleToTime( int angle, int speed) -{ -int fullRotationTime; // time to rotate 360 degrees at given speed - - if(speed < MIN_SPEED) - return 0; // ignore speeds slower then the first table entry - - angle = abs(angle); - - if(speed >= 100) - fullRotationTime = rotationTime[NBR_SPEEDS-1]; // the last entry is 100% - else - { - int index = (speed - MIN_SPEED) / SPEED_TABLE_INTERVAL ; // index into speed and time tables - int t0 = rotationTime[index]; - int t1 = rotationTime[index+1]; // time of the next higher speed - fullRotationTime = map(speed, speedTable[index], speedTable[index+1], t0, t1); - // Serial.print("index= "); Serial.print(index); Serial.print(", t0 = "); Serial.print(t0); Serial.print(", t1 = "); Serial.print(t1); - } - // Serial.print(" full rotation time = "); Serial.println(fullRotationTime); - long result = map(angle, 0,360, 0, fullRotationTime); - return result; -} - -// rotate the robot from MIN_SPEED to 100% increasing by SPEED_TABLE_INTERVAL -void calibrateRotationRate(int sensor, int angle) -{ - Serial.print(locationString[sensor]); - Serial.println(" calibration" ); - for(int speed = MIN_SPEED; speed <= 100; speed += SPEED_TABLE_INTERVAL) - { - delay(1000); - blinkNumber(speed/10); - - if( sensor == DIR_LEFT) - { // rotate left - motorReverse(MOTOR_LEFT, speed); - motorForward(MOTOR_RIGHT, speed); - } - else if( sensor == DIR_RIGHT) - { // rotate right - motorForward(MOTOR_LEFT, speed); - motorReverse(MOTOR_RIGHT, speed); - } - else - Serial.println("Invalid sensor"); - - int time = rotationAngleToTime(angle, speed); - - Serial.print(locationString[sensor]); - Serial.print(": rotate "); - Serial.print(angle); - Serial.print(" degrees at speed "); - Serial.print(speed); - Serial.print(" for "); - Serial.print(time); - Serial.println("ms"); - delay(time); - motorStop(MOTOR_LEFT); - motorStop(MOTOR_RIGHT); - delay(2000); // two second delay between speeds - } -} - diff --git a/ardu_robot/globalDefines.h b/ardu_robot/globalDefines.h deleted file mode 100644 index 94b991a..0000000 --- a/ardu_robot/globalDefines.h +++ /dev/null @@ -1,23 +0,0 @@ - -// defines to identify sensors -const int SENSE_IR_LEFT = 0; -const int SENSE_IR_RIGHT = 1; - -// defines for directions -const int DIR_LEFT = 0; -const int DIR_RIGHT = 1; -const int DIR_CENTER = 2; - -const char* locationString[] = {"Left", "Right", "Center"}; // Debug labels -// http://arduino.cc/en/Reference/String for more on character string arrays - -// obstacles constants -const int OBST_NONE = 0; // no obstacle detected -const int OBST_LEFT_EDGE = 1; // left edge detected -const int OBST_RIGHT_EDGE = 2; // right edge detected -const int OBST_FRONT_EDGE = 3; // edge detect at both left and right sensors - -const int LED_PIN = 13; - -/**** End of Global Defines ****************/ - diff --git a/car_driver/.vscode/settings.json b/car_driver/.vscode/settings.json index d3ba527..94de60a 100644 --- a/car_driver/.vscode/settings.json +++ b/car_driver/.vscode/settings.json @@ -1,4 +1,5 @@ { "C_Cpp.errorSquiggles": "Disabled", - "arduino.defaultBaudRate": 9600 + "arduino.defaultBaudRate": 9600, + "arduino.clearOutputOnBuild": true } diff --git a/car_driver/arduino/arduino.ino b/car_driver/arduino/arduino.ino index 98e1b2c..37844a4 100644 --- a/car_driver/arduino/arduino.ino +++ b/car_driver/arduino/arduino.ino @@ -1,5 +1,4 @@ #define HEADER 'H' -#define TOTAL_BYTES 3 const int MOVE_FORWARD[2] = {0, 2}; // 2 == -1 == up const int MOVE_LEFT[2] = {2, 0}; // move left @@ -10,46 +9,50 @@ const int MOVE_STOP[2] = {0, 0}; // stop void setup() { Serial.begin(9600); Serial.println("initialized"); + Serial.setTimeout(10); begin(); - processCommand(0, 2); } void loop() { - if (Serial.available() >= TOTAL_BYTES) { - // sample format: H11 or H02, etc. - char header = Serial.read(); - if (header == HEADER) { // done reading header, next number is a tag - char tmp = Serial.read(); - int x = (tmp - '0'); - tmp = Serial.read(); - int y = (tmp - '0'); - processCommand(x, y); // process the command + if (Serial.available() > 0) { + String string = Serial.readString(); + string.trim(); + char header = string[0]; + if (header == HEADER) { + int delimiter = string.indexOf(','); + int x = string.substring(1, delimiter).toInt(); + int y = string.substring(delimiter + 1).toInt(); + processCommand(x, y); } } } +#define DEADZONE 10 // @param cmd the thing that tells it what to do, usually a vector(01, 22). void processCommand(const int x, const int y) { - const int cmd[] = {x, y}; - if (arrayCmp(cmd, MOVE_FORWARD)) { - forward(); - } else if (arrayCmp(cmd, MOVE_STOP)) { - stop(); - } else if (arrayCmp(cmd, MOVE_LEFT)) { - left(); - } else if (arrayCmp(cmd, MOVE_RIGHT)) { - right(); - } else if (arrayCmp(cmd, MOVE_BACK)) { - backward(); + if (x > 100 || x < -100 || y > 100 || y < -100) { + Serial.println("invalid command"); + } + if (x < DEADZONE && x >= 0) { + // apply brakes to motora + brakeMotorA(); + } else if (x < 0) { + motorABackward(abs(x) + 155); } else { - Serial.print("( "); - Serial.print(x); - Serial.print(", "); - Serial.print(y); - Serial.println(" ) Ignored"); + // positive number: 100 + 155 = 255 + motorAForward(x + 155); } -} - -bool arrayCmp(const int array[], const int array2[]) { - return array[0] == array2[0] && array[1] == array2[1]; + if (y < DEADZONE && y >= 0) { + // apply brakes to motorb + brakeMotorB(); + } else if (y < 0) { // negative number: -100 + 355 = 255 + motorBBackward(abs(y) + 155); + } else { + // apply speed to motorb + motorBForward(y + 155); + } + Serial.print("x: "); + Serial.print(String(x)); + Serial.print(" y: "); + Serial.println(String(y)); }
\ No newline at end of file diff --git a/car_driver/arduino/drive.ino b/car_driver/arduino/drive.ino index 718b532..4ced292 100644 --- a/car_driver/arduino/drive.ino +++ b/car_driver/arduino/drive.ino @@ -6,8 +6,6 @@ #define BrakeMotorB 8 #define MotorBSpeed 11 -#define SPEED 255 // speed of motors - void begin() { // Setup Channel A pinMode(MotorA, OUTPUT); @@ -18,38 +16,29 @@ void begin() { pinMode(BrakeMotorB, OUTPUT); } +// @param direction LOW is backwards, HIGH is forward +// @param speed 0-255 +void motor(int motorpin, int motorbrake, int motorspeed, int direction, + int speed) { + digitalWrite(motorpin, direction); + digitalWrite(motorbrake, LOW); // brake off + analogWrite(motorspeed, speed); // speed up +} + void motorAForward(int speed) { - digitalWrite(MotorA, HIGH); // forward - digitalWrite(BrakeMotorA, LOW); // brake off - analogWrite(MotorASpeed, speed); // speed of motor + motor(MotorA, BrakeMotorA, MotorASpeed, HIGH, speed); } void motorBForward(int speed) { - digitalWrite(MotorB, HIGH); // forward - digitalWrite(BrakeMotorB, LOW); // brake off - analogWrite(MotorBSpeed, speed); // speed of motor + motor(MotorB, BrakeMotorB, MotorBSpeed, HIGH, speed); } void motorBBackward(int speed) { - digitalWrite(MotorB, LOW); // backwards - digitalWrite(BrakeMotorB, LOW); // brake off - analogWrite(MotorBSpeed, speed); // speed of motor + motor(MotorB, BrakeMotorB, MotorBSpeed, LOW, speed); } void motorABackward(int speed) { - digitalWrite(MotorA, LOW); // backwards - digitalWrite(BrakeMotorA, LOW); // brake off - analogWrite(MotorASpeed, speed); // speed of motor -} - -void forward() { - motorAForward(SPEED); - motorBForward(SPEED); -} - -void backward() { - motorABackward(SPEED); - motorBBackward(SPEED); + motor(MotorA, BrakeMotorA, MotorASpeed, LOW, speed); } void brakeMotorA() { @@ -65,14 +54,4 @@ void brakeMotorB() { void stop() { brakeMotorA(); brakeMotorB(); -} - -void left() { - brakeMotorA(); - motorBForward(SPEED); -} - -void right() { - brakeMotorB(); - motorAForward(SPEED); }
\ No newline at end of file diff --git a/car_driver/godot/.gitignore b/car_driver/godot/.gitignore new file mode 100644 index 0000000..8eced34 --- /dev/null +++ b/car_driver/godot/.gitignore @@ -0,0 +1,2 @@ +godot/.import +.vscode/ diff --git a/car_driver/godot/Console.gd b/car_driver/godot/Console.gd deleted file mode 100644 index 29ac7a9..0000000 --- a/car_driver/godot/Console.gd +++ /dev/null @@ -1,10 +0,0 @@ -extends RichTextLabel -class_name Console - - -func _ready(): - SerialIO.connect("recieved", self, "add_text") - - -func add_text(new: String): - text += new diff --git a/car_driver/godot/Console.tscn b/car_driver/godot/Console.tscn deleted file mode 100644 index 026ec44..0000000 --- a/car_driver/godot/Console.tscn +++ /dev/null @@ -1,42 +0,0 @@ -[gd_scene load_steps=4 format=2] - -[ext_resource path="res://ConsoleWindow.gd" type="Script" id=1] -[ext_resource path="res://Console.gd" type="Script" id=2] -[ext_resource path="res://theme.theme" type="Theme" id=3] - -[node name="ConsoleWindow" type="WindowDialog"] -visible = true -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_top = 40.0 -margin_right = -440.0 -margin_bottom = -220.0 -rect_min_size = Vector2( 300, 200 ) -theme = ExtResource( 3 ) -window_title = "Serial Monitor" -resizable = true -script = ExtResource( 1 ) - -[node name="V" type="VBoxContainer" parent="."] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 8.0 -margin_right = -4.0 - -[node name="Send" type="LineEdit" parent="V"] -margin_right = 288.0 -margin_bottom = 40.0 -placeholder_text = "input text" -caret_blink = true - -[node name="Console" type="RichTextLabel" parent="V"] -margin_top = 44.0 -margin_right = 288.0 -margin_bottom = 200.0 -focus_mode = 2 -size_flags_vertical = 3 -scroll_following = true -selection_enabled = true -script = ExtResource( 2 ) - -[connection signal="text_entered" from="V/Send" to="." method="_on_Send_text_entered"] diff --git a/car_driver/godot/ConsoleWindow.gd b/car_driver/godot/ConsoleWindow.gd deleted file mode 100644 index a37106a..0000000 --- a/car_driver/godot/ConsoleWindow.gd +++ /dev/null @@ -1,19 +0,0 @@ -extends WindowDialog - -onready var send = $V/Send - - -func _ready(): - call_deferred("popup_centered_minsize") - - -func _process(_delta := 0.0): - rect_position.x = clamp(rect_position.x, 0, OS.get_window_size().x - rect_size.x) - rect_position.y = clamp(rect_position.y, 20, OS.get_window_size().y - rect_size.y) - - -func _on_Send_text_entered(new_text: String): - new_text = new_text.strip_edges().strip_escapes() - if new_text: - SerialIO.send(new_text) - send.text = "" diff --git a/car_driver/godot/Input.gd b/car_driver/godot/Input.gd index 4606f45..2275e9e 100644 --- a/car_driver/godot/Input.gd +++ b/car_driver/godot/Input.gd @@ -1,25 +1,36 @@ extends Node -var input : Vector2 +var input := Vector2.ZERO -func prepare(v: Vector2) -> Vector2: - v = v.normalized() - if v.x < 0: - v.x = 1 - v.x - if v.y < 0: - v.y = 1 - v.y - v=v.round() - return v +var fast := false + +onready var lb = $Label func _physics_process(_delta): var inp := get_input() - if input != inp: - print(inp) + if inp != input: input = inp - SerialIO.send("H%s%s" % [inp.x, inp.y]) + lb.text = str(input) + SerialIO.write("H%s,%s" % [input.x, input.y]) + + +func _ready(): + yield(get_tree(), "idle_frame") + SerialIO.write("H0,0") #stop + lb.text = str(input) + -func get_input()->Vector2: - var x := Input.get_axis("ui_left", "ui_right") - var y := Input.get_axis("ui_up", "ui_down") - return prepare(Vector2(x, y)) +func get_input() -> Vector2: + if Input.is_action_just_pressed("sped"): + fast = !fast + var x := Input.get_action_strength("leftpaddle") + var y := Input.get_action_strength("rightpaddle") + var multiplier := 100 if fast else 50 + var v := Vector2(x, y) * multiplier + # if button is pressed, reverse, if no paddle input, move slow + if Input.is_action_pressed("lb"): + v.x = -v.x if v.x else -multiplier / 4.0 + if Input.is_action_pressed("rb"): + v.y = -v.y if v.y else -multiplier / 4.0 + return (v).round() diff --git a/car_driver/godot/Main.tscn b/car_driver/godot/Main.tscn index f420f25..62a9f55 100644 --- a/car_driver/godot/Main.tscn +++ b/car_driver/godot/Main.tscn @@ -1,13 +1,20 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://Console.tscn" type="PackedScene" id=1] [ext_resource path="res://Input.gd" type="Script" id=2] +[ext_resource path="res://theme.theme" type="Theme" id=3] [node name="Main" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 - -[node name="ConsoleWindow" parent="." instance=ExtResource( 1 )] +theme = ExtResource( 3 ) [node name="input" type="Node" parent="."] script = ExtResource( 2 ) + +[node name="Label" type="Label" parent="input"] +margin_left = 8.0 +margin_top = 8.0 +margin_right = 52.0 +margin_bottom = 28.0 +theme = ExtResource( 3 ) +text = "input" diff --git a/car_driver/godot/bin/linux64/libGDSercomm.so b/car_driver/godot/bin/linux64/libGDSercomm.so Binary files differindex bf96e61..ace8c09 100644..100755 --- a/car_driver/godot/bin/linux64/libGDSercomm.so +++ b/car_driver/godot/bin/linux64/libGDSercomm.so diff --git a/car_driver/godot/bin/linux64/libsercomm.so b/car_driver/godot/bin/linux64/libsercomm.so Binary files differindex 4e69e00..b6182a5 100644..100755 --- a/car_driver/godot/bin/linux64/libsercomm.so +++ b/car_driver/godot/bin/linux64/libsercomm.so diff --git a/car_driver/godot/logs/godot.log b/car_driver/godot/logs/godot.log deleted file mode 100644 index 0f99df2..0000000 --- a/car_driver/godot/logs/godot.log +++ /dev/null @@ -1,5 +0,0 @@ -Godot Engine v3.4.4.stable.arch_linux - https://godotengine.org -OpenGL ES 3.0 Renderer: Mesa Intel(R) UHD Graphics 600 (GLK 2) -OpenGL ES Batching: ON - -connecting to /dev/ttyACM0 diff --git a/car_driver/godot/logs/godot_2022-06-11_15.10.34.log b/car_driver/godot/logs/godot_2022-06-11_15.10.34.log deleted file mode 100644 index 87894a1..0000000 --- a/car_driver/godot/logs/godot_2022-06-11_15.10.34.log +++ /dev/null @@ -1,5 +0,0 @@ -Godot Engine v3.4.4.stable.arch_linux - https://godotengine.org -OpenGL ES 3.0 Renderer: Mesa Intel(R) UHD Graphics 600 (GLK 2) -OpenGL ES Batching: ON - -[/dev/ttyS9, /dev/ttyS8, /dev/ttyS31, /dev/ttyS30, /dev/ttyS3, /dev/ttyS29, /dev/ttyS28, /dev/ttyS27, /dev/ttyS26, /dev/ttyS25, /dev/ttyS24, /dev/ttyS23, /dev/ttyS22, /dev/ttyS21, /dev/ttyS20, /dev/ttyS2, /dev/ttyS19, /dev/ttyS18, /dev/ttyS17, /dev/ttyS16, /dev/ttyS15, /dev/ttyS14, /dev/ttyS13, /dev/ttyS12, /dev/ttyS11, /dev/ttyS10, /dev/ttyS1, /dev/ttyS0, /dev/ttyS7, /dev/ttyS6, /dev/ttyS5, /dev/ttyS4, /dev/ttyACM0] diff --git a/car_driver/godot/logs/godot_2022-06-11_15.17.29.log b/car_driver/godot/logs/godot_2022-06-11_15.17.29.log deleted file mode 100644 index 0f99df2..0000000 --- a/car_driver/godot/logs/godot_2022-06-11_15.17.29.log +++ /dev/null @@ -1,5 +0,0 @@ -Godot Engine v3.4.4.stable.arch_linux - https://godotengine.org -OpenGL ES 3.0 Renderer: Mesa Intel(R) UHD Graphics 600 (GLK 2) -OpenGL ES Batching: ON - -connecting to /dev/ttyACM0 diff --git a/car_driver/godot/logs/godot_2022-06-11_15.17.37.log b/car_driver/godot/logs/godot_2022-06-11_15.17.37.log deleted file mode 100644 index 0f99df2..0000000 --- a/car_driver/godot/logs/godot_2022-06-11_15.17.37.log +++ /dev/null @@ -1,5 +0,0 @@ -Godot Engine v3.4.4.stable.arch_linux - https://godotengine.org -OpenGL ES 3.0 Renderer: Mesa Intel(R) UHD Graphics 600 (GLK 2) -OpenGL ES Batching: ON - -connecting to /dev/ttyACM0 diff --git a/car_driver/godot/logs/godot_2022-06-11_15.19.20.log b/car_driver/godot/logs/godot_2022-06-11_15.19.20.log deleted file mode 100644 index 0f99df2..0000000 --- a/car_driver/godot/logs/godot_2022-06-11_15.19.20.log +++ /dev/null @@ -1,5 +0,0 @@ -Godot Engine v3.4.4.stable.arch_linux - https://godotengine.org -OpenGL ES 3.0 Renderer: Mesa Intel(R) UHD Graphics 600 (GLK 2) -OpenGL ES Batching: ON - -connecting to /dev/ttyACM0 diff --git a/car_driver/godot/project.godot b/car_driver/godot/project.godot index c30ab58..52c26be 100644 --- a/car_driver/godot/project.godot +++ b/car_driver/godot/project.godot @@ -8,16 +8,6 @@ config_version=4 -_global_script_classes=[ { -"base": "RichTextLabel", -"class": "Console", -"language": "GDScript", -"path": "res://Console.gd" -} ] -_global_script_class_icons={ -"Console": "" -} - [application] config/name="car controller" @@ -34,9 +24,8 @@ gdscript/warnings/return_value_discarded=false [display] -window/size/width=640 -window/size/height=360 -window/stretch/mode="2d" +window/size/width=1280 +window/size/height=720 window/stretch/aspect="expand" [input] @@ -69,6 +58,31 @@ ui_down={ , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null) ] } +leftpaddle={ +"deadzone": 0.5, +"events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":6,"axis_value":1.0,"script":null) + ] +} +rightpaddle={ +"deadzone": 0.5, +"events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":7,"axis_value":1.0,"script":null) + ] +} +lb={ +"deadzone": 0.5, +"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":4,"pressure":0.0,"pressed":false,"script":null) + ] +} +rb={ +"deadzone": 0.5, +"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":5,"pressure":0.0,"pressed":false,"script":null) + ] +} +sped={ +"deadzone": 0.5, +"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null) + ] +} [rendering] diff --git a/car_driver/godot/serial.gd b/car_driver/godot/serial.gd index dfb3a0f..674d4c2 100644 --- a/car_driver/godot/serial.gd +++ b/car_driver/godot/serial.gd @@ -1,48 +1,30 @@ extends Node -onready var Serial = preload("res://bin/GDsercomm.gdns").new() +const Serial = preload("res://bin/GDsercomm.gdns") +onready var serial = Serial.new() const baud_rate := 9600 const endline := "\n" -signal recieved(text) -#a readline function, just add the current Port (based on sercomm) -#and it will return a line, since sercomm always use a timeout, it should not lag +#@param text the text to send +func write(text: String) -> void: #"please only use ascii" + if serial.write(text) != 0: #asshole used unicode + print("serial broke, reloading(%s)" % text) + create_serial() -func readline(port): - if !port.has_method("read"): #to avoid problems - return "NOT A PORT" - var cho = "" - var chango = "" - while cho != endline: - cho = port.read() - if typeof(cho) == TYPE_STRING: - if cho != endline: - chango += cho - else: - chango = "FAILED" - break - return chango - - -func _physics_process(_delta: float): - var text = "" - for _i in range(Serial.get_available()): - text += str(Serial.read()) - if text: - emit_signal("recieved", text) - - -func send(text: String) -> void: #"please only use ascii" - Serial.write(text) +func create_serial(): + if serial: + serial.close() + serial = Serial.new() + serial.call_deferred("open", get_ports()[-1], baud_rate, 1000) func _ready(): prints("connecting to", get_ports()[-1]) - Serial.call_deferred("open", get_ports()[-1], baud_rate, 1000) + create_serial() func get_ports() -> Array: - return Serial.list_ports() + return serial.list_ports() diff --git a/car_driver/processing/processing.pde b/car_driver/processing/processing.pde deleted file mode 100644 index 5e10e54..0000000 --- a/car_driver/processing/processing.pde +++ /dev/null @@ -1,45 +0,0 @@ -import processing.serial.*; - -private static char STOP = 'v'; -private static char HEADER = 'H'; - -char current = STOP; - -Serial port; - -void setup() { - frameRate(5); - printArray(Serial.list()); - port = new Serial(this, Serial.list()[0], 9600); -} - - -void draw() {} // Empty draw() needed to keep the program running - -void keyPressed() { - updateKeys(key, true); -} - -void keyReleased() { - updateKeys(key, false); -} - -boolean isValidKey(char key) { - return key == 'a' || key == 'w' || key == 's' || key == 'd'; -} - -void write(char key) { - char data[] = {HEADER, key}; - String towrite = new String(data); - println(towrite); - port.write(towrite); -} - -void updateKeys(char key, boolean on) { - if (isValidKey(key)) { - if (!on || key != current) { - current = on ? key : STOP; - write(current); - } - } -} diff --git a/generated_examples/MotorTest/.vscode/arduino.json b/generated_examples/MotorTest/.vscode/arduino.json deleted file mode 100644 index c84b3ab..0000000 --- a/generated_examples/MotorTest/.vscode/arduino.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sketch": "MotorTest.ino", - "port": "/dev/ttyACM0", - "board": "arduino:avr:uno" -}
\ No newline at end of file diff --git a/generated_examples/MotorTest/MotorTest.ino b/generated_examples/MotorTest/MotorTest.ino deleted file mode 100644 index 422335a..0000000 --- a/generated_examples/MotorTest/MotorTest.ino +++ /dev/null @@ -1,50 +0,0 @@ - -void setup() -{ - - // Setup Channel A - pinMode(12, OUTPUT); // Initiates Motor Channel A pin - pinMode(9, OUTPUT); // Initiates Brake Channel A pin - - // Setup Channel B - pinMode(13, OUTPUT); // Initiates Motor Channel A pin - pinMode(8, OUTPUT); // Initiates Brake Channel A pin -} - -void loop() -{ - - // Motor A forward @ full speed - digitalWrite(12, HIGH); // Establishes forward direction of Channel A - digitalWrite(9, LOW); // Disengage the Brake for Channel A - analogWrite(3, 255); // Spins the motor on Channel A at full speed - - // Motor B backward @ half speed - digitalWrite(13, LOW); // Establishes backward direction of Channel B - digitalWrite(8, LOW); // Disengage the Brake for Channel B - analogWrite(11, 123); // Spins the motor on Channel B at half speed - - delay(3000); - - digitalWrite(9, HIGH); // Engage the Brake for Channel A - digitalWrite(9, HIGH); // Engage the Brake for Channel B - - delay(1000); - - // Motor A forward @ full speed - digitalWrite(12, LOW); // Establishes backward direction of Channel A - digitalWrite(9, LOW); // Disengage the Brake for Channel A - analogWrite(3, 123); // Spins the motor on Channel A at half speed - - // Motor B forward @ full speed - digitalWrite(13, HIGH); // Establishes forward direction of Channel B - digitalWrite(8, LOW); // Disengage the Brake for Channel B - analogWrite(11, 255); // Spins the motor on Channel B at full speed - - delay(3000); - - digitalWrite(9, HIGH); // Engage the Brake for Channel A - digitalWrite(9, HIGH); // Engage the Brake for Channel B - - delay(1000); -} diff --git a/generated_examples/MotorTest/but.png b/generated_examples/MotorTest/but.png Binary files differdeleted file mode 100644 index da8f7c2..0000000 --- a/generated_examples/MotorTest/but.png +++ /dev/null diff --git a/led_matrix/led_matrix.ino b/led_matrix/led_matrix.ino deleted file mode 100644 index ee70825..0000000 --- a/led_matrix/led_matrix.ino +++ /dev/null @@ -1,154 +0,0 @@ -//update from SAnwandter - -#define ROW_1 2 -#define ROW_2 3 -#define ROW_3 4 -#define ROW_4 5 -#define ROW_5 6 -#define ROW_6 7 -#define ROW_7 8 -#define ROW_8 9 - -#define COL_1 10 -#define COL_2 11 -#define COL_3 12 -#define COL_4 13 -#define COL_5 A0 -#define COL_6 A1 -#define COL_7 A2 -#define COL_8 A3 - -const byte rows[] = { - ROW_1, ROW_2, ROW_3, ROW_4, ROW_5, ROW_6, ROW_7, ROW_8 -}; -const byte col[] = { - COL_1,COL_2, COL_3, COL_4, COL_5, COL_6, COL_7, COL_8 -}; - -// The display buffer -// It's prefilled with a smiling face (1 = ON, 0 = OFF) -byte ALL[] = {B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111}; -byte EX[] = {B00000000,B00010000,B00010000,B00010000,B00010000,B00000000,B00010000,B00000000}; -byte A[] = { B00000000,B00111100,B01100110,B01100110,B01111110,B01100110,B01100110,B01100110}; -byte B[] = {B01111000,B01001000,B01001000,B01110000,B01001000,B01000100,B01000100,B01111100}; -byte C[] = {B00000000,B00011110,B00100000,B01000000,B01000000,B01000000,B00100000,B00011110}; -byte D[] = {B00000000,B00111000,B00100100,B00100010,B00100010,B00100100,B00111000,B00000000}; -byte E[] = {B00000000,B00111100,B00100000,B00111000,B00100000,B00100000,B00111100,B00000000}; -byte F[] = {B00000000,B00111100,B00100000,B00111000,B00100000,B00100000,B00100000,B00000000}; -byte G[] = {B00000000,B00111110,B00100000,B00100000,B00101110,B00100010,B00111110,B00000000}; -byte H[] = {B00000000,B00100100,B00100100,B00111100,B00100100,B00100100,B00100100,B00000000}; -byte I[] = {B00000000,B00111000,B00010000,B00010000,B00010000,B00010000,B00111000,B00000000}; -byte J[] = {B00000000,B00011100,B00001000,B00001000,B00001000,B00101000,B00111000,B00000000}; -byte K[] = {B00000000,B00100100,B00101000,B00110000,B00101000,B00100100,B00100100,B00000000}; -byte L[] = {B00000000,B00100000,B00100000,B00100000,B00100000,B00100000,B00111100,B00000000}; -byte M[] = {B00000000,B00000000,B01000100,B10101010,B10010010,B10000010,B10000010,B00000000}; -byte N[] = {B00000000,B00100010,B00110010,B00101010,B00100110,B00100010,B00000000,B00000000}; -byte O[] = {B00000000,B00111100,B01000010,B01000010,B01000010,B01000010,B00111100,B00000000}; -byte P[] = {B00000000,B00111000,B00100100,B00100100,B00111000,B00100000,B00100000,B00000000}; -byte Q[] = {B00000000,B00111100,B01000010,B01000010,B01000010,B01000110,B00111110,B00000001}; -byte R[] = {B00000000,B00111000,B00100100,B00100100,B00111000,B00100100,B00100100,B00000000}; -byte S[] = {B00000000,B00111100,B00100000,B00111100,B00000100,B00000100,B00111100,B00000000}; -byte T[] = {B00000000,B01111100,B00010000,B00010000,B00010000,B00010000,B00010000,B00000000}; -byte U[] = {B00000000,B01000010,B01000010,B01000010,B01000010,B00100100,B00011000,B00000000}; -byte V[] = {B00000000,B00100010,B00100010,B00100010,B00010100,B00010100,B00001000,B00000000}; -byte W[] = {B00000000,B10000010,B10010010,B01010100,B01010100,B00101000,B00000000,B00000000}; -byte X[] = {B00000000,B01000010,B00100100,B00011000,B00011000,B00100100,B01000010,B00000000}; -byte Y[] = {B00000000,B01000100,B00101000,B00010000,B00010000,B00010000,B00010000,B00000000}; -byte Z[] = {B00000000,B00111100,B00000100,B00001000,B00010000,B00100000,B00111100,B00000000}; - -float timeCount = 0; - -void setup() -{ - // Open serial port - Serial.begin(9600); - - // Set all used pins to OUTPUT - // This is very important! If the pins are set to input - // the display will be very dim. - for (byte i = 2; i <= 13; i++) - pinMode(i, OUTPUT); - pinMode(A0, OUTPUT); - pinMode(A1, OUTPUT); - pinMode(A2, OUTPUT); - pinMode(A3, OUTPUT); -} - -void loop() { - // This could be rewritten to not use a delay, which would make it appear brighter -delay(5); -timeCount += 1; - -if(timeCount < 20) -{ -drawScreen(A); -} -else if (timeCount < 40) -{ -drawScreen(R); -} -else if (timeCount < 60) -{ -drawScreen(D); -} -else if (timeCount < 80) -{ -drawScreen(U); -} -else if (timeCount < 100) -{ -drawScreen(I); -} -else if (timeCount < 120) -{ -drawScreen(N); -} -else if (timeCount < 140) { - drawScreen(O); -} -else if (timeCount < 160) -{ -drawScreen(ALL); -} -else if (timeCount < 180) -{ -drawScreen(ALL); -} -else { -// back to the start -timeCount = 0; -} -} - void drawScreen(byte buffer2[]) - { - // Turn on each row in series - for (byte i = 0; i < 8; i++) // count next row - { - digitalWrite(rows[i], HIGH); //initiate whole row - for (byte a = 0; a < 8; a++) // count next row - { - // if You set (~buffer2[i] >> a) then You will have positive - digitalWrite(col[a], (buffer2[i] >> a) & 0x01); // initiate whole column - - delayMicroseconds(100); // uncoment deley for diferent speed of display - //delayMicroseconds(1000); - //delay(10); - //delay(100); - - digitalWrite(col[a], 1); // reset whole column - } - digitalWrite(rows[i], LOW); // reset whole row - // otherwise last row will intersect with next row - } -} -// - /* this is siplest resemplation how for loop is working with each row. - digitalWrite(COL_1, (~b >> 0) & 0x01); // Get the 1st bit: 10000000 - digitalWrite(COL_2, (~b >> 1) & 0x01); // Get the 2nd bit: 01000000 - digitalWrite(COL_3, (~b >> 2) & 0x01); // Get the 3rd bit: 00100000 - digitalWrite(COL_4, (~b >> 3) & 0x01); // Get the 4th bit: 00010000 - digitalWrite(COL_5, (~b >> 4) & 0x01); // Get the 5th bit: 00001000 - digitalWrite(COL_6, (~b >> 5) & 0x01); // Get the 6th bit: 00000100 - digitalWrite(COL_7, (~b >> 6) & 0x01); // Get the 7th bit: 00000010 - digitalWrite(COL_8, (~b >> 7) & 0x01); // Get the 8th bit: 00000001 -}*/
\ No newline at end of file diff --git a/test_motor/.vscode/arduino.json b/libraries/Servo/examples/Sweep/.vscode/arduino.json index cfc8883..f95d465 100644 --- a/test_motor/.vscode/arduino.json +++ b/libraries/Servo/examples/Sweep/.vscode/arduino.json @@ -1,5 +1,5 @@ { "board": "arduino:avr:uno", - "sketch": "test_motor.ino", + "sketch": "Sweep.ino", "port": "/dev/ttyACM0" }
\ No newline at end of file diff --git a/generated_examples/MotorTest/.vscode/c_cpp_properties.json b/libraries/Servo/examples/Sweep/.vscode/c_cpp_properties.json index 3d8779a..d18dc4d 100644 --- a/generated_examples/MotorTest/.vscode/c_cpp_properties.json +++ b/libraries/Servo/examples/Sweep/.vscode/c_cpp_properties.json @@ -18,6 +18,7 @@ "includePath": [ "/home/bendn/.arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino", "/home/bendn/.arduino15/packages/arduino/hardware/avr/1.8.4/variants/standard", + "/home/bendn/Arduino/libraries/Servo/src", "/home/bendn/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/lib/gcc/avr/7.3.0/include", "/home/bendn/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/lib/gcc/avr/7.3.0/include-fixed", "/home/bendn/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/avr/include" diff --git a/sequenced_led/.theia/launch.json b/sequenced_led/.theia/launch.json deleted file mode 100644 index af2138c..0000000 --- a/sequenced_led/.theia/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - "version": "0.2.0", - "configurations": [ - - { - "cwd": "${workspaceRoot}", - "executable": "./bin/executable.elf", - "name": "Debug Microcontroller", - "request": "launch", - "type": "cortex-debug", - "servertype": "openocd" - } - ] -} diff --git a/sequenced_led/sequenced_led.ino b/sequenced_led/sequenced_led.ino deleted file mode 100644 index 2ccc081..0000000 --- a/sequenced_led/sequenced_led.ino +++ /dev/null @@ -1,50 +0,0 @@ -int pins[] = {9, 10, 11}; - -void setup() { - Serial.begin(9600); - for(int i = 0; i <= 2; i++) { - pinMode(pins[i], OUTPUT); - } -} - -void fade(int pin, int length = 30, int hold = 1000, int times = 1) { - int brightness = 0; - int fadeAmount = 7; - int done_times = 0; - bool up = true; - while (true) { - analogWrite(pin, brightness); - - brightness = brightness + fadeAmount; - if (brightness > 254) { // dont know how to use max - brightness = 255; - } - // wait - delay(length); - if (brightness <= 1 || brightness >= 252) { - fadeAmount = -fadeAmount; - up = !up; - - if (up) { //reached bottom, going back up again. - done_times++; - // Serial.println("going back up?"); - if (done_times == times) { - analogWrite(pin, 0); // turn off the light - break; - } - delay(hold); - } - } - } -} - -void loop() { - for(int i = 0; i <= 2; i++) { - int delay = 30; - switch (i) { - case 0 : fade(pins[i], 15, 2000); break; // red - case 1 : fade(pins[i], 5, 200, 5); break; // yellow - case 2 : fade(pins[i], 15, 5000); break; // green - } - } -} diff --git a/sketch_feb12c/sketch_feb12c.ino b/sketch_feb12c/sketch_feb12c.ino deleted file mode 100644 index 63c60e2..0000000 --- a/sketch_feb12c/sketch_feb12c.ino +++ /dev/null @@ -1,40 +0,0 @@ -/* - Fade - - This example shows how to fade an LED on pin 9 using the analogWrite() - function. - - The analogWrite() function uses PWM, so if you want to change the pin you're - using, be sure to use another PWM capable pin. On most Arduino, the PWM pins - are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11. - - This example code is in the public domain. - - https://www.arduino.cc/en/Tutorial/BuiltInExamples/Fade -*/ - -int led = 13; // the PWM pin the LED is attached to -int brightness = 0; // how bright the LED is -int fadeAmount = 5; // how many points to fade the LED by - -// the setup routine runs once when you press reset: -void setup() { - // declare pin 9 to be an output: - pinMode(led, OUTPUT); -} - -// the loop routine runs over and over again forever: -void loop() { - // set the brightness of pin 9: - analogWrite(led, brightness); - - // change the brightness for next time through the loop: - brightness = brightness + fadeAmount; - - // reverse the direction of the fading at the ends of the fade: - if (brightness <= 0 || brightness >= 255) { - fadeAmount = -fadeAmount; - } - // wait for 30 milliseconds to see the dimming effect - delay(50); -} diff --git a/test_motor/.vscode/c_cpp_properties.json b/test_motor/.vscode/c_cpp_properties.json deleted file mode 100644 index 8ea0b19..0000000 --- a/test_motor/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,539 +0,0 @@ -{ - "version": 4, - "configurations": [ - { - "name": "Arduino", - "compilerPath": "/home/bendn/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++", - "compilerArgs": [ - "-w", - "-std=gnu++11", - "-fpermissive", - "-fno-exceptions", - "-ffunction-sections", - "-fdata-sections", - "-fno-threadsafe-statics", - "-Wno-error=narrowing" - ], - "intelliSenseMode": "gcc-x64", - "includePath": [ - "/home/bendn/.arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino", - "/home/bendn/.arduino15/packages/arduino/hardware/avr/1.8.4/variants/standard", - "/home/bendn/Arduino/libraries/AFMotor", - "/home/bendn/Arduino/libraries/RobotMotor", - "/home/bendn/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/lib/gcc/avr/7.3.0/include", - "/home/bendn/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/lib/gcc/avr/7.3.0/include-fixed", - "/home/bendn/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/avr/include" - ], - "forcedInclude": [ - "/home/bendn/.arduino15/packages/arduino/hardware/avr/1.8.4/cores/arduino/Arduino.h" - ], - "cStandard": "c11", - "cppStandard": "c++11", - "defines": [ - "F_CPU=16000000L", - "ARDUINO=10607", - "ARDUINO_AVR_UNO", - "ARDUINO_ARCH_AVR", - "__DBL_MIN_EXP__=(-125)", - "__HQ_FBIT__=15", - "__cpp_attributes=200809", - "__UINT_LEAST16_MAX__=0xffffU", - "__ATOMIC_ACQUIRE=2", - "__SFRACT_IBIT__=0", - "__FLT_MIN__=1.17549435e-38F", - "__GCC_IEC_559_COMPLEX=0", - "__BUILTIN_AVR_SLEEP=1", - "__BUILTIN_AVR_COUNTLSULLK=1", - "__cpp_aggregate_nsdmi=201304", - "__BUILTIN_AVR_COUNTLSULLR=1", - "__UFRACT_MAX__=0XFFFFP-16UR", - "__UINT_LEAST8_TYPE__=unsigned char", - "__DQ_FBIT__=63", - "__INTMAX_C(c)=c ## LL", - "__ULFRACT_FBIT__=32", - "__SACCUM_EPSILON__=0x1P-7HK", - "__CHAR_BIT__=8", - "__USQ_IBIT__=0", - "__UINT8_MAX__=0xff", - "__ACCUM_FBIT__=15", - "__WINT_MAX__=0x7fff", - "__FLT32_MIN_EXP__=(-125)", - "__cpp_static_assert=200410", - "__USFRACT_FBIT__=8", - "__ORDER_LITTLE_ENDIAN__=1234", - "__SIZE_MAX__=0xffffU", - "__WCHAR_MAX__=0x7fff", - "__LACCUM_IBIT__=32", - "__DBL_DENORM_MIN__=double(1.40129846e-45L)", - "__GCC_ATOMIC_CHAR_LOCK_FREE=1", - "__GCC_IEC_559=0", - "__FLT_EVAL_METHOD__=0", - "__BUILTIN_AVR_LLKBITS=1", - "__cpp_binary_literals=201304", - "__LLACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-47LLK", - "__GCC_ATOMIC_CHAR32_T_LOCK_FREE=1", - "__BUILTIN_AVR_HKBITS=1", - "__BUILTIN_AVR_BITSLLK=1", - "__FRACT_FBIT__=15", - "__BUILTIN_AVR_BITSLLR=1", - "__cpp_variadic_templates=200704", - "__UINT_FAST64_MAX__=0xffffffffffffffffULL", - "__SIG_ATOMIC_TYPE__=char", - "__BUILTIN_AVR_UHKBITS=1", - "__UACCUM_FBIT__=16", - "__DBL_MIN_10_EXP__=(-37)", - "__FINITE_MATH_ONLY__=0", - "__cpp_variable_templates=201304", - "__LFRACT_IBIT__=0", - "__GNUC_PATCHLEVEL__=0", - "__FLT32_HAS_DENORM__=1", - "__LFRACT_MAX__=0X7FFFFFFFP-31LR", - "__UINT_FAST8_MAX__=0xff", - "__has_include(STR)=__has_include__(STR)", - "__DEC64_MAX_EXP__=385", - "__INT8_C(c)=c", - "__INT_LEAST8_WIDTH__=8", - "__UINT_LEAST64_MAX__=0xffffffffffffffffULL", - "__SA_FBIT__=15", - "__SHRT_MAX__=0x7fff", - "__LDBL_MAX__=3.40282347e+38L", - "__FRACT_MAX__=0X7FFFP-15R", - "__UFRACT_FBIT__=16", - "__UFRACT_MIN__=0.0UR", - "__UINT_LEAST8_MAX__=0xff", - "__GCC_ATOMIC_BOOL_LOCK_FREE=1", - "__UINTMAX_TYPE__=long long unsigned int", - "__LLFRACT_EPSILON__=0x1P-63LLR", - "__BUILTIN_AVR_DELAY_CYCLES=1", - "__DEC32_EPSILON__=1E-6DF", - "__FLT_EVAL_METHOD_TS_18661_3__=0", - "__UINT32_MAX__=0xffffffffUL", - "__GXX_EXPERIMENTAL_CXX0X__=1", - "__ULFRACT_MAX__=0XFFFFFFFFP-32ULR", - "__TA_IBIT__=16", - "__LDBL_MAX_EXP__=128", - "__WINT_MIN__=(-__WINT_MAX__ - 1)", - "__INT_LEAST16_WIDTH__=16", - "__ULLFRACT_MIN__=0.0ULLR", - "__SCHAR_MAX__=0x7f", - "__WCHAR_MIN__=(-__WCHAR_MAX__ - 1)", - "__INT64_C(c)=c ## LL", - "__DBL_DIG__=6", - "__GCC_ATOMIC_POINTER_LOCK_FREE=1", - "__AVR_HAVE_SPH__=1", - "__LLACCUM_MIN__=(-0X1P15LLK-0X1P15LLK)", - "__BUILTIN_AVR_KBITS=1", - "__BUILTIN_AVR_ABSK=1", - "__BUILTIN_AVR_ABSR=1", - "__SIZEOF_INT__=2", - "__SIZEOF_POINTER__=2", - "__GCC_ATOMIC_CHAR16_T_LOCK_FREE=1", - "__USACCUM_IBIT__=8", - "__USER_LABEL_PREFIX__", - "__STDC_HOSTED__=1", - "__LDBL_HAS_INFINITY__=1", - "__LFRACT_MIN__=(-0.5LR-0.5LR)", - "__HA_IBIT__=8", - "__FLT32_DIG__=6", - "__TQ_IBIT__=0", - "__FLT_EPSILON__=1.19209290e-7F", - "__GXX_WEAK__=1", - "__SHRT_WIDTH__=16", - "__USFRACT_IBIT__=0", - "__LDBL_MIN__=1.17549435e-38L", - "__FRACT_MIN__=(-0.5R-0.5R)", - "__AVR_SFR_OFFSET__=0x20", - "__DEC32_MAX__=9.999999E96DF", - "__cpp_threadsafe_static_init=200806", - "__DA_IBIT__=32", - "__INT32_MAX__=0x7fffffffL", - "__UQQ_FBIT__=8", - "__INT_WIDTH__=16", - "__SIZEOF_LONG__=4", - "__UACCUM_MAX__=0XFFFFFFFFP-16UK", - "__UINT16_C(c)=c ## U", - "__PTRDIFF_WIDTH__=16", - "__DECIMAL_DIG__=9", - "__LFRACT_EPSILON__=0x1P-31LR", - "__AVR_2_BYTE_PC__=1", - "__ULFRACT_MIN__=0.0ULR", - "__INTMAX_WIDTH__=64", - "__has_include_next(STR)=__has_include_next__(STR)", - "__BUILTIN_AVR_ULLRBITS=1", - "__LDBL_HAS_QUIET_NAN__=1", - "__ULACCUM_IBIT__=32", - "__UACCUM_EPSILON__=0x1P-16UK", - "__BUILTIN_AVR_SEI=1", - "__GNUC__=7", - "__ULLACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-48ULLK", - "__cpp_delegating_constructors=200604", - "__HQ_IBIT__=0", - "__BUILTIN_AVR_SWAP=1", - "__FLT_HAS_DENORM__=1", - "__SIZEOF_LONG_DOUBLE__=4", - "__BIGGEST_ALIGNMENT__=1", - "__STDC_UTF_16__=1", - "__UINT24_MAX__=16777215UL", - "__BUILTIN_AVR_NOP=1", - "__GNUC_STDC_INLINE__=1", - "__DQ_IBIT__=0", - "__FLT32_HAS_INFINITY__=1", - "__DBL_MAX__=double(3.40282347e+38L)", - "__ULFRACT_IBIT__=0", - "__cpp_raw_strings=200710", - "__INT_FAST32_MAX__=0x7fffffffL", - "__DBL_HAS_INFINITY__=1", - "__INT64_MAX__=0x7fffffffffffffffLL", - "__ACCUM_IBIT__=16", - "__DEC32_MIN_EXP__=(-94)", - "__BUILTIN_AVR_UKBITS=1", - "__INTPTR_WIDTH__=16", - "__BUILTIN_AVR_FMULSU=1", - "__LACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-31LK", - "__INT_FAST16_TYPE__=int", - "__LDBL_HAS_DENORM__=1", - "__BUILTIN_AVR_BITSK=1", - "__BUILTIN_AVR_BITSR=1", - "__cplusplus=201402L", - "__cpp_ref_qualifiers=200710", - "__DEC128_MAX__=9.999999999999999999999999999999999E6144DL", - "__INT_LEAST32_MAX__=0x7fffffffL", - "__USING_SJLJ_EXCEPTIONS__=1", - "__DEC32_MIN__=1E-95DF", - "__ACCUM_MAX__=0X7FFFFFFFP-15K", - "__DEPRECATED=1", - "__cpp_rvalue_references=200610", - "__DBL_MAX_EXP__=128", - "__USACCUM_EPSILON__=0x1P-8UHK", - "__WCHAR_WIDTH__=16", - "__FLT32_MAX__=3.40282347e+38F32", - "__DEC128_EPSILON__=1E-33DL", - "__SFRACT_MAX__=0X7FP-7HR", - "__FRACT_IBIT__=0", - "__PTRDIFF_MAX__=0x7fff", - "__UACCUM_MIN__=0.0UK", - "__UACCUM_IBIT__=16", - "__BUILTIN_AVR_NOPS=1", - "__BUILTIN_AVR_WDR=1", - "__FLT32_HAS_QUIET_NAN__=1", - "__GNUG__=7", - "__LONG_LONG_MAX__=0x7fffffffffffffffLL", - "__SIZEOF_SIZE_T__=2", - "__ULACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-32ULK", - "__cpp_rvalue_reference=200610", - "__cpp_nsdmi=200809", - "__SIZEOF_WINT_T__=2", - "__LONG_LONG_WIDTH__=64", - "__cpp_initializer_lists=200806", - "__FLT32_MAX_EXP__=128", - "__SA_IBIT__=16", - "__ULLACCUM_MIN__=0.0ULLK", - "__BUILTIN_AVR_ROUNDUHK=1", - "__BUILTIN_AVR_ROUNDUHR=1", - "__cpp_hex_float=201603", - "__GXX_ABI_VERSION=1011", - "__INT24_MAX__=8388607L", - "__UTA_FBIT__=48", - "__FLT_MIN_EXP__=(-125)", - "__USFRACT_MAX__=0XFFP-8UHR", - "__UFRACT_IBIT__=0", - "__BUILTIN_AVR_ROUNDFX=1", - "__BUILTIN_AVR_ROUNDULK=1", - "__BUILTIN_AVR_ROUNDULR=1", - "__cpp_lambdas=200907", - "__BUILTIN_AVR_COUNTLSLLK=1", - "__BUILTIN_AVR_COUNTLSLLR=1", - "__BUILTIN_AVR_ROUNDHK=1", - "__INT_FAST64_TYPE__=long long int", - "__BUILTIN_AVR_ROUNDHR=1", - "__DBL_MIN__=double(1.17549435e-38L)", - "__BUILTIN_AVR_COUNTLSK=1", - "__BUILTIN_AVR_ROUNDLK=1", - "__BUILTIN_AVR_COUNTLSR=1", - "__BUILTIN_AVR_ROUNDLR=1", - "__LACCUM_MIN__=(-0X1P31LK-0X1P31LK)", - "__ULLACCUM_FBIT__=48", - "__BUILTIN_AVR_LKBITS=1", - "__ULLFRACT_EPSILON__=0x1P-64ULLR", - "__DEC128_MIN__=1E-6143DL", - "__REGISTER_PREFIX__", - "__UINT16_MAX__=0xffffU", - "__DBL_HAS_DENORM__=1", - "__BUILTIN_AVR_ULKBITS=1", - "__ACCUM_MIN__=(-0X1P15K-0X1P15K)", - "__AVR_ARCH__=2", - "__SQ_IBIT__=0", - "__FLT32_MIN__=1.17549435e-38F32", - "__UINT8_TYPE__=unsigned char", - "__BUILTIN_AVR_ROUNDUK=1", - "__BUILTIN_AVR_ROUNDUR=1", - "__UHA_FBIT__=8", - "__NO_INLINE__=1", - "__SFRACT_MIN__=(-0.5HR-0.5HR)", - "__UTQ_FBIT__=128", - "__FLT_MANT_DIG__=24", - "__LDBL_DECIMAL_DIG__=9", - "__VERSION__=\"7.3.0\"", - "__UINT64_C(c)=c ## ULL", - "__ULLFRACT_FBIT__=64", - "__cpp_unicode_characters=200704", - "__FRACT_EPSILON__=0x1P-15R", - "__ULACCUM_MIN__=0.0ULK", - "__UDA_FBIT__=32", - "__cpp_decltype_auto=201304", - "__LLACCUM_EPSILON__=0x1P-47LLK", - "__GCC_ATOMIC_INT_LOCK_FREE=1", - "__FLT32_MANT_DIG__=24", - "__BUILTIN_AVR_BITSUHK=1", - "__BUILTIN_AVR_BITSUHR=1", - "__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__", - "__USFRACT_MIN__=0.0UHR", - "__BUILTIN_AVR_BITSULK=1", - "__ULLACCUM_IBIT__=16", - "__BUILTIN_AVR_BITSULR=1", - "__UQQ_IBIT__=0", - "__BUILTIN_AVR_LLRBITS=1", - "__SCHAR_WIDTH__=8", - "__BUILTIN_AVR_BITSULLK=1", - "__BUILTIN_AVR_BITSULLR=1", - "__INT32_C(c)=c ## L", - "__DEC64_EPSILON__=1E-15DD", - "__ORDER_PDP_ENDIAN__=3412", - "__DEC128_MIN_EXP__=(-6142)", - "__UHQ_FBIT__=16", - "__LLACCUM_FBIT__=47", - "__FLT32_MAX_10_EXP__=38", - "__BUILTIN_AVR_ROUNDULLK=1", - "__BUILTIN_AVR_ROUNDULLR=1", - "__INT_FAST32_TYPE__=long int", - "__BUILTIN_AVR_HRBITS=1", - "__UINT_LEAST16_TYPE__=unsigned int", - "__BUILTIN_AVR_UHRBITS=1", - "__INT16_MAX__=0x7fff", - "__SIZE_TYPE__=unsigned int", - "__UINT64_MAX__=0xffffffffffffffffULL", - "__UDQ_FBIT__=64", - "__INT8_TYPE__=signed char", - "__cpp_digit_separators=201309", - "__ELF__=1", - "__ULFRACT_EPSILON__=0x1P-32ULR", - "__LLFRACT_FBIT__=63", - "__FLT_RADIX__=2", - "__INT_LEAST16_TYPE__=int", - "__BUILTIN_AVR_ABSFX=1", - "__LDBL_EPSILON__=1.19209290e-7L", - "__UINTMAX_C(c)=c ## ULL", - "__INT24_MIN__=(-__INT24_MAX__-1)", - "__SACCUM_MAX__=0X7FFFP-7HK", - "__BUILTIN_AVR_ABSHR=1", - "__SIG_ATOMIC_MAX__=0x7f", - "__GCC_ATOMIC_WCHAR_T_LOCK_FREE=1", - "__cpp_sized_deallocation=201309", - "__SIZEOF_PTRDIFF_T__=2", - "__AVR=1", - "__BUILTIN_AVR_ABSLK=1", - "__BUILTIN_AVR_ABSLR=1", - "__LACCUM_EPSILON__=0x1P-31LK", - "__DEC32_SUBNORMAL_MIN__=0.000001E-95DF", - "__INT_FAST16_MAX__=0x7fff", - "__UINT_FAST32_MAX__=0xffffffffUL", - "__UINT_LEAST64_TYPE__=long long unsigned int", - "__USACCUM_MAX__=0XFFFFP-8UHK", - "__SFRACT_EPSILON__=0x1P-7HR", - "__FLT_HAS_QUIET_NAN__=1", - "__FLT_MAX_10_EXP__=38", - "__LONG_MAX__=0x7fffffffL", - "__DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL", - "__FLT_HAS_INFINITY__=1", - "__cpp_unicode_literals=200710", - "__USA_FBIT__=16", - "__UINT_FAST16_TYPE__=unsigned int", - "__DEC64_MAX__=9.999999999999999E384DD", - "__INT_FAST32_WIDTH__=32", - "__BUILTIN_AVR_RBITS=1", - "__CHAR16_TYPE__=unsigned int", - "__PRAGMA_REDEFINE_EXTNAME=1", - "__SIZE_WIDTH__=16", - "__INT_LEAST16_MAX__=0x7fff", - "__DEC64_MANT_DIG__=16", - "__UINT_LEAST32_MAX__=0xffffffffUL", - "__SACCUM_FBIT__=7", - "__FLT32_DENORM_MIN__=1.40129846e-45F32", - "__GCC_ATOMIC_LONG_LOCK_FREE=1", - "__SIG_ATOMIC_WIDTH__=8", - "__INT_LEAST64_TYPE__=long long int", - "__INT16_TYPE__=int", - "__INT_LEAST8_TYPE__=signed char", - "__SQ_FBIT__=31", - "__DEC32_MAX_EXP__=97", - "__INT_FAST8_MAX__=0x7f", - "__INTPTR_MAX__=0x7fff", - "__QQ_FBIT__=7", - "__cpp_range_based_for=200907", - "__UTA_IBIT__=16", - "__AVR_ERRATA_SKIP__=1", - "__FLT32_MIN_10_EXP__=(-37)", - "__LDBL_MANT_DIG__=24", - "__SFRACT_FBIT__=7", - "__SACCUM_MIN__=(-0X1P7HK-0X1P7HK)", - "__DBL_HAS_QUIET_NAN__=1", - "__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)", - "AVR=1", - "__BUILTIN_AVR_FMULS=1", - "__cpp_return_type_deduction=201304", - "__INTPTR_TYPE__=int", - "__UINT16_TYPE__=unsigned int", - "__WCHAR_TYPE__=int", - "__SIZEOF_FLOAT__=4", - "__AVR__=1", - "__BUILTIN_AVR_INSERT_BITS=1", - "__USQ_FBIT__=32", - "__UINTPTR_MAX__=0xffffU", - "__INT_FAST64_WIDTH__=64", - "__DEC64_MIN_EXP__=(-382)", - "__cpp_decltype=200707", - "__FLT32_DECIMAL_DIG__=9", - "__INT_FAST64_MAX__=0x7fffffffffffffffLL", - "__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1", - "__FLT_DIG__=6", - "__UINT_FAST64_TYPE__=long long unsigned int", - "__BUILTIN_AVR_BITSHK=1", - "__BUILTIN_AVR_BITSHR=1", - "__INT_MAX__=0x7fff", - "__LACCUM_FBIT__=31", - "__USACCUM_MIN__=0.0UHK", - "__UHA_IBIT__=8", - "__INT64_TYPE__=long long int", - "__BUILTIN_AVR_BITSLK=1", - "__BUILTIN_AVR_BITSLR=1", - "__FLT_MAX_EXP__=128", - "__UTQ_IBIT__=0", - "__DBL_MANT_DIG__=24", - "__cpp_inheriting_constructors=201511", - "__BUILTIN_AVR_ULLKBITS=1", - "__INT_LEAST64_MAX__=0x7fffffffffffffffLL", - "__DEC64_MIN__=1E-383DD", - "__WINT_TYPE__=int", - "__UINT_LEAST32_TYPE__=long unsigned int", - "__SIZEOF_SHORT__=2", - "__ULLFRACT_IBIT__=0", - "__LDBL_MIN_EXP__=(-125)", - "__UDA_IBIT__=32", - "__WINT_WIDTH__=16", - "__INT_LEAST8_MAX__=0x7f", - "__LFRACT_FBIT__=31", - "__LDBL_MAX_10_EXP__=38", - "__ATOMIC_RELAXED=0", - "__DBL_EPSILON__=double(1.19209290e-7L)", - "__BUILTIN_AVR_BITSUK=1", - "__BUILTIN_AVR_BITSUR=1", - "__UINT8_C(c)=c", - "__INT_LEAST32_TYPE__=long int", - "__BUILTIN_AVR_URBITS=1", - "__SIZEOF_WCHAR_T__=2", - "__LLFRACT_MAX__=0X7FFFFFFFFFFFFFFFP-63LLR", - "__TQ_FBIT__=127", - "__INT_FAST8_TYPE__=signed char", - "__ULLACCUM_EPSILON__=0x1P-48ULLK", - "__BUILTIN_AVR_ROUNDK=1", - "__BUILTIN_AVR_ROUNDR=1", - "__UHQ_IBIT__=0", - "__LLACCUM_IBIT__=16", - "__FLT32_EPSILON__=1.19209290e-7F32", - "__DBL_DECIMAL_DIG__=9", - "__STDC_UTF_32__=1", - "__INT_FAST8_WIDTH__=8", - "__DEC_EVAL_METHOD__=2", - "__TA_FBIT__=47", - "__UDQ_IBIT__=0", - "__ORDER_BIG_ENDIAN__=4321", - "__cpp_runtime_arrays=198712", - "__WITH_AVRLIBC__=1", - "__UINT64_TYPE__=long long unsigned int", - "__ACCUM_EPSILON__=0x1P-15K", - "__UINT32_C(c)=c ## UL", - "__BUILTIN_AVR_COUNTLSUHK=1", - "__INTMAX_MAX__=0x7fffffffffffffffLL", - "__cpp_alias_templates=200704", - "__BUILTIN_AVR_COUNTLSUHR=1", - "__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__", - "__FLT_DENORM_MIN__=1.40129846e-45F", - "__LLFRACT_IBIT__=0", - "__INT8_MAX__=0x7f", - "__LONG_WIDTH__=32", - "__UINT_FAST32_TYPE__=long unsigned int", - "__CHAR32_TYPE__=long unsigned int", - "__BUILTIN_AVR_COUNTLSULK=1", - "__BUILTIN_AVR_COUNTLSULR=1", - "__FLT_MAX__=3.40282347e+38F", - "__cpp_constexpr=201304", - "__USACCUM_FBIT__=8", - "__BUILTIN_AVR_COUNTLSFX=1", - "__INT32_TYPE__=long int", - "__SIZEOF_DOUBLE__=4", - "__FLT_MIN_10_EXP__=(-37)", - "__UFRACT_EPSILON__=0x1P-16UR", - "__INT_LEAST32_WIDTH__=32", - "__BUILTIN_AVR_COUNTLSHK=1", - "__BUILTIN_AVR_COUNTLSHR=1", - "__INTMAX_TYPE__=long long int", - "__BUILTIN_AVR_ABSLLK=1", - "__BUILTIN_AVR_ABSLLR=1", - "__DEC128_MAX_EXP__=6145", - "__AVR_HAVE_16BIT_SP__=1", - "__ATOMIC_CONSUME=1", - "__GNUC_MINOR__=3", - "__INT_FAST16_WIDTH__=16", - "__UINTMAX_MAX__=0xffffffffffffffffULL", - "__DEC32_MANT_DIG__=7", - "__HA_FBIT__=7", - "__BUILTIN_AVR_COUNTLSLK=1", - "__BUILTIN_AVR_COUNTLSLR=1", - "__BUILTIN_AVR_CLI=1", - "__DBL_MAX_10_EXP__=38", - "__LDBL_DENORM_MIN__=1.40129846e-45L", - "__INT16_C(c)=c", - "__cpp_generic_lambdas=201304", - "__STDC__=1", - "__PTRDIFF_TYPE__=int", - "__LLFRACT_MIN__=(-0.5LLR-0.5LLR)", - "__BUILTIN_AVR_LRBITS=1", - "__ATOMIC_SEQ_CST=5", - "__DA_FBIT__=31", - "__UINT32_TYPE__=long unsigned int", - "__BUILTIN_AVR_ROUNDLLK=1", - "__UINTPTR_TYPE__=unsigned int", - "__BUILTIN_AVR_ROUNDLLR=1", - "__USA_IBIT__=16", - "__BUILTIN_AVR_ULRBITS=1", - "__DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD", - "__DEC128_MANT_DIG__=34", - "__LDBL_MIN_10_EXP__=(-37)", - "__BUILTIN_AVR_COUNTLSUK=1", - "__BUILTIN_AVR_COUNTLSUR=1", - "__SIZEOF_LONG_LONG__=8", - "__ULACCUM_EPSILON__=0x1P-32ULK", - "__cpp_user_defined_literals=200809", - "__SACCUM_IBIT__=8", - "__GCC_ATOMIC_LLONG_LOCK_FREE=1", - "__LDBL_DIG__=6", - "__FLT_DECIMAL_DIG__=9", - "__UINT_FAST16_MAX__=0xffffU", - "__GCC_ATOMIC_SHORT_LOCK_FREE=1", - "__BUILTIN_AVR_ABSHK=1", - "__BUILTIN_AVR_FLASH_SEGMENT=1", - "__INT_LEAST64_WIDTH__=64", - "__ULLFRACT_MAX__=0XFFFFFFFFFFFFFFFFP-64ULLR", - "__UINT_FAST8_TYPE__=unsigned char", - "__USFRACT_EPSILON__=0x1P-8UHR", - "__ULACCUM_FBIT__=32", - "__QQ_IBIT__=0", - "__cpp_init_captures=201304", - "__ATOMIC_ACQ_REL=4", - "__ATOMIC_RELEASE=3", - "__BUILTIN_AVR_FMUL=1", - "USBCON" - ] - } - ] -}
\ No newline at end of file diff --git a/test_motor/test_motor.ino b/test_motor/test_motor.ino deleted file mode 100644 index af2b789..0000000 --- a/test_motor/test_motor.ino +++ /dev/null @@ -1,13 +0,0 @@ -#include <AFMotor.h> // adafruit motor shield library -#include "RobotMotor.h" - -void setup(){ - motorBegin(MOTOR_LEFT); - motorBegin(MOTOR_RIGHT); - motorSetSpeed(MOTOR_LEFT, 15); - motorSetSpeed(MOTOR_RIGHT, 15); - motorStop(MOTOR_LEFT); - motorStop(MOTOR_RIGHT); -} - -void loop(){}
\ No newline at end of file diff --git a/ultras test/ultras test.ino b/ultras test/ultras test.ino deleted file mode 100644 index 2c99a72..0000000 --- a/ultras test/ultras test.ino +++ /dev/null @@ -1,39 +0,0 @@ -#include <NewPing.h> - -// Ultrasonic Sensor testing code. Written by a 13 year old. -//#include NewPing.h// Imports the NewPing Library. -#define ledPin 12 -#define trigPin 10 -#define echoPin 9 -int duration, distance; // Add types 'duration' and 'distance'. - -void setup() -{ - Serial.begin(9600); - pinMode (ledPin, OUTPUT); // The LED must be controlled by Arduino, it means it is an output type. - pinMode (trigPin, OUTPUT);// Same as above, the TRIG pin will send the ultrasonic wave. - pinMode (echoPin, INPUT); // The ECHO pin will recieve the rebounded wave, so it must be an input type. -} -void loop() -{ - digitalWrite (ledPin, LOW); // Here, LOW means off and HIGH means on. - digitalWrite (trigPin, HIGH); - delay(50); - digitalWrite (trigPin, LOW); - duration=pulseIn(echoPin,HIGH); - distance=(duration/2)/29.1; - - if(distance <=30) - { - digitalWrite (ledPin, HIGH); - delay(50); - } - - else - { - digitalWrite (ledPin, LOW); - delay(50); - Serial.print("cm"); - Serial.println(distance); - } -}
\ No newline at end of file |