aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arduino-mk/Arduino.mk47
-rw-r--r--examples/AnalogInOutSerial/AnalogInOutSerial.ino53
-rw-r--r--examples/AnalogInOutSerial/Makefile9
-rw-r--r--releases/arduino-mk_0.2.tar.gzbin3350 -> 0 bytes
-rw-r--r--releases/arduino-mk_0.3.tar.gzbin12873 -> 0 bytes
-rw-r--r--releases/arduino-mk_0.4.tar.gzbin13152 -> 0 bytes
-rw-r--r--releases/arduino-mk_0.5.tar.gzbin13431 -> 0 bytes
-rw-r--r--releases/arduino-mk_0.6.tar.gzbin15756 -> 0 bytes
-rw-r--r--releases/arduino-mk_0.7.tar.gzbin15995 -> 0 bytes
-rw-r--r--releases/arduino-mk_0.8.tar.gzbin16432 -> 0 bytes
10 files changed, 106 insertions, 3 deletions
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index 5e8cf8e..26fd3bb 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -64,11 +64,15 @@
# provided patches in the same spirit.
#
# 0.9 26.iv.2012 M J Oldfield
-# - Allow the punter to specify boards.txt file
-# and parser independently (after Peplin on github)
+# - Allow the punter to specify boards.txt
+# file and parser independently (after
+# Peplin and Brotchie on github)
# - Support user libraries (Peplin's patch)
# - Remove main.cpp if NO_CORE_MAIN_CPP is
# defined (ex Peplin)
+# - Added a monitor target which talks to the
+# Arduino serial port (Peplin's suggestion)
+#
#
########################################################################
#
@@ -131,6 +135,25 @@
# make reset - reset the Arduino by tickling DTR on the serial port
# make raw_upload - upload without first resetting
# make show_boards - list all the boards defined in boards.txt
+# make monitor - connect to the Arduino's serial port
+#
+########################################################################
+#
+# SERIAL MONITOR
+#
+# The serial monitor just invokes the GNU screen program with suitable
+# options. For more information see screen (1) and search for
+# 'character special device'.
+#
+# The really useful thing to know is that ^A-k gets you out!
+#
+# The fairly useful thing to know is that you can bind another key to
+# escape too, by creating $HOME{.screenrc} containing e.g.
+#
+# bindkey ^C kill
+#
+# If you want to change the baudrate, just set MONITOR_BAUDRATE. If you
+# don't set it, it defaults to 9600 baud.
#
########################################################################
#
@@ -219,6 +242,21 @@ endif
endif
########################################################################
+# Serial monitor (just a screen wrapper)
+#
+# Quite how to construct the monitor command seems intimately tied
+# to the command we're using (here screen). So, read the screen docs
+# for more information (search for 'character special device').
+#
+ifndef MONITOR_BAUDRATE
+MONITOR_BAUDRATE = 9600
+endif
+
+ifndef MONITOR_CMD
+MONITOR_CMD = screen
+endif
+
+########################################################################
# boards.txt parsing
#
ifndef BOARD_TAG
@@ -550,6 +588,9 @@ size: $(OBJDIR) $(TARGET_HEX)
show_boards:
$(PARSE_BOARD_CMD) --boards
-.PHONY: all clean depends upload raw_upload reset size show_boards
+monitor:
+ $(MONITOR_CMD) $(ARD_PORT) $(MONITOR_BAUDRATE)
+
+.PHONY: all clean depends upload raw_upload reset size show_boards monitor
include $(DEP_FILE)
diff --git a/examples/AnalogInOutSerial/AnalogInOutSerial.ino b/examples/AnalogInOutSerial/AnalogInOutSerial.ino
new file mode 100644
index 0000000..e142f69
--- /dev/null
+++ b/examples/AnalogInOutSerial/AnalogInOutSerial.ino
@@ -0,0 +1,53 @@
+/*
+ Analog input, analog output, serial output
+
+ Reads an analog input pin, maps the result to a range from 0 to 255
+ and uses the result to set the pulsewidth modulation (PWM) of an output pin.
+ Also prints the results to the serial monitor.
+
+ The circuit:
+ * potentiometer connected to analog pin 0.
+ Center pin of the potentiometer goes to the analog pin.
+ side pins of the potentiometer go to +5V and ground
+ * LED connected from digital pin 9 to ground
+
+ created 29 Dec. 2008
+ modified 30 Aug 2011
+ by Tom Igoe
+
+ This example code is in the public domain.
+
+ */
+
+// These constants won't change. They're used to give names
+// to the pins used:
+const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
+const int analogOutPin = 9; // Analog output pin that the LED is attached to
+
+int sensorValue = 0; // value read from the pot
+int outputValue = 0; // value output to the PWM (analog out)
+
+void setup() {
+ // initialize serial communications at 9600 bps:
+ Serial.begin(9600);
+}
+
+void loop() {
+ // read the analog in value:
+ sensorValue = analogRead(analogInPin);
+ // map it to the range of the analog out:
+ outputValue = map(sensorValue, 0, 1023, 0, 255);
+ // change the analog out value:
+ analogWrite(analogOutPin, outputValue);
+
+ // print the results to the serial monitor:
+ Serial.print("sensor = " );
+ Serial.print(sensorValue);
+ Serial.print("\t output = ");
+ Serial.println(outputValue);
+
+ // wait 10 milliseconds before the next loop
+ // for the analog-to-digital converter to settle
+ // after the last reading:
+ delay(10);
+}
diff --git a/examples/AnalogInOutSerial/Makefile b/examples/AnalogInOutSerial/Makefile
new file mode 100644
index 0000000..5c8c1dd
--- /dev/null
+++ b/examples/AnalogInOutSerial/Makefile
@@ -0,0 +1,9 @@
+ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
+PARSE_BOARD = ../../arduino-mk/ard-parse-boards
+
+BOARD_TAG = uno
+ARDUINO_PORT = /dev/cu.usb*
+
+ARDUINO_LIBS =
+
+include ../../arduino-mk/Arduino.mk \ No newline at end of file
diff --git a/releases/arduino-mk_0.2.tar.gz b/releases/arduino-mk_0.2.tar.gz
deleted file mode 100644
index 6f341e2..0000000
--- a/releases/arduino-mk_0.2.tar.gz
+++ /dev/null
Binary files differ
diff --git a/releases/arduino-mk_0.3.tar.gz b/releases/arduino-mk_0.3.tar.gz
deleted file mode 100644
index 9a9e349..0000000
--- a/releases/arduino-mk_0.3.tar.gz
+++ /dev/null
Binary files differ
diff --git a/releases/arduino-mk_0.4.tar.gz b/releases/arduino-mk_0.4.tar.gz
deleted file mode 100644
index fa8b241..0000000
--- a/releases/arduino-mk_0.4.tar.gz
+++ /dev/null
Binary files differ
diff --git a/releases/arduino-mk_0.5.tar.gz b/releases/arduino-mk_0.5.tar.gz
deleted file mode 100644
index ce3e9e6..0000000
--- a/releases/arduino-mk_0.5.tar.gz
+++ /dev/null
Binary files differ
diff --git a/releases/arduino-mk_0.6.tar.gz b/releases/arduino-mk_0.6.tar.gz
deleted file mode 100644
index 4bd8f23..0000000
--- a/releases/arduino-mk_0.6.tar.gz
+++ /dev/null
Binary files differ
diff --git a/releases/arduino-mk_0.7.tar.gz b/releases/arduino-mk_0.7.tar.gz
deleted file mode 100644
index e753302..0000000
--- a/releases/arduino-mk_0.7.tar.gz
+++ /dev/null
Binary files differ
diff --git a/releases/arduino-mk_0.8.tar.gz b/releases/arduino-mk_0.8.tar.gz
deleted file mode 100644
index 91ff5bb..0000000
--- a/releases/arduino-mk_0.8.tar.gz
+++ /dev/null
Binary files differ