From 5564f0db954aa36db8e70440bec3eccceec6689a Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Tue, 4 Jan 2022 20:14:58 +0000 Subject: [PATCH] Fix all! --- .gitignore | 1 + motor_controller/Makefile | 9 +++++-- motor_controller/README.md | 13 ++++++++++ motor_controller/motor_controller.ino | 35 +++------------------------ motor_controller/requirements.txt | 2 +- 5 files changed, 25 insertions(+), 35 deletions(-) create mode 100644 motor_controller/README.md diff --git a/.gitignore b/.gitignore index 533e4b1..9603dbe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Backups/Generated Artifacts _build *.FCStd1 +version.h # Binaries *.stl diff --git a/motor_controller/Makefile b/motor_controller/Makefile index cc4ec07..6b63297 100644 --- a/motor_controller/Makefile +++ b/motor_controller/Makefile @@ -7,7 +7,7 @@ PROJ := motor_controller # What board to build for and its core CORE ?= arduino:avr -FQBN ?= arduino:avr:mega +FQBN ?= arduino:avr:nano # Tools, their links and versions ARDUINO_CLI_VERSION := @@ -84,11 +84,16 @@ requirements: @if [ -e requirements.txt ]; \ then while read -r i ; do echo ; \ echo "---> Installing " '"'$$i'"' ; \ - $(BINDIR)/arduino-cli lib install "$$i" ; \ + $(BINDIR)/arduino-cli lib install $$i ; \ done < requirements.txt ; \ else echo "---> MISSING requirements.txt file"; \ fi +# Monitor the serial (debug) output. +# Requires minicom +monitor: upload + minicom -c on -D $(SERIAL_DEV) -b 115200 + lint: $(BINDIR)/arduino-lint --compliance strict diff --git a/motor_controller/README.md b/motor_controller/README.md new file mode 100644 index 0000000..40328a9 --- /dev/null +++ b/motor_controller/README.md @@ -0,0 +1,13 @@ +# Motor Controller + +## Notes on custom libs + +micro ros is not in the lib repo i guess? so you gotta enable unsafe libs and install from git + +change `enable_unsafe_install: true` in your `arduino-cli.yaml` + +use this to init this file + +``` +./_build/bin/arduino-cli config init +``` diff --git a/motor_controller/motor_controller.ino b/motor_controller/motor_controller.ino index 9abb8f5..ae9c935 100644 --- a/motor_controller/motor_controller.ino +++ b/motor_controller/motor_controller.ino @@ -1,37 +1,8 @@ -/* - Blink - - Turns an LED on for one second, then off for one second, repeatedly. - - Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO - it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to - the correct LED pin independent of which board is used. - If you want to know what pin the on-board LED is connected to on your Arduino - model, check the Technical Specs of your board at: - https://www.arduino.cc/en/Main/Products - - modified 8 May 2014 - by Scott Fitzgerald - modified 2 Sep 2016 - by Arturo Guadalupi - modified 8 Sep 2016 - by Colby Newman - - This example code is in the public domain. - - https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink -*/ - -// the setup function runs once when you press reset or power the board void setup() { - // initialize digital pin LED_BUILTIN as an output. - pinMode(LED_BUILTIN, OUTPUT); + Serial.begin(115200); } -// the loop function runs over and over again forever void loop() { - digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) - delay(1000); // wait for a second - digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW - delay(1000); // wait for a second + Serial.println(millis()); + delay(1000); } diff --git a/motor_controller/requirements.txt b/motor_controller/requirements.txt index 5e09d0b..8d4de30 100644 --- a/motor_controller/requirements.txt +++ b/motor_controller/requirements.txt @@ -1 +1 @@ -micro_ros_arduino +--git-url https://github.com/micro-ROS/micro_ros_arduino.git