summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kauerz <kauerz@informatik.uni-luebeck.de>2012-02-15 20:52:30 +0100
committerAlexander Kauerz <kauerz@informatik.uni-luebeck.de>2012-02-15 20:52:30 +0100
commit4fd4cdfc86c0c1326fb73fd7302227dd299bab45 (patch)
treed17b22a6fe6befed666d736d8877d75ffc35e947
parent12169019447f2d583a67010db8efb6f06820d76e (diff)
downloadledmatrix-4fd4cdfc86c0c1326fb73fd7302227dd299bab45.tar
ledmatrix-4fd4cdfc86c0c1326fb73fd7302227dd299bab45.zip
drehimpulsgeber test, nicht mal alpha..
-rw-r--r--Drehimpulsgeber/CMakeLists.txt27
-rw-r--r--Drehimpulsgeber/drehimp.cpp19
2 files changed, 46 insertions, 0 deletions
diff --git a/Drehimpulsgeber/CMakeLists.txt b/Drehimpulsgeber/CMakeLists.txt
new file mode 100644
index 0000000..be09f29
--- /dev/null
+++ b/Drehimpulsgeber/CMakeLists.txt
@@ -0,0 +1,27 @@
+#=============================================================================#
+# Author: QueezyTheGreat #
+# Date: 26.04.2011 #
+# #
+# Description: Arduino CMake example #
+# #
+#=============================================================================#
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) # CMake module search path
+set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Arduino.cmake) # Arduino Toolchain
+set(ARDUINO_LINKER_FLAGS "-lc -lm")
+set(ARDUINO_SDK_PATH ${CMAKE_SOURCE_DIR}/../arduino-1.0)
+
+cmake_minimum_required(VERSION 2.8)
+#====================================================================#
+# Setup Project #
+#====================================================================#
+project(Drehimpusgebertest)
+find_package(Arduino 1.0 REQUIRED)
+
+set(FIRMWARE_NAME LIFE)
+
+set(${FIRMWARE_NAME}_SRCS drehimp.cpp)
+set(${FIRMWARE_NAME}_BOARD atmega328)
+set(${FIRMWARE_NAME}_LIBS m )
+set(${FIRMWARE_NAME}_PORT /dev/ttyUSB0)
+
+generate_arduino_firmware(${FIRMWARE_NAME})
diff --git a/Drehimpulsgeber/drehimp.cpp b/Drehimpulsgeber/drehimp.cpp
new file mode 100644
index 0000000..21011e7
--- /dev/null
+++ b/Drehimpulsgeber/drehimp.cpp
@@ -0,0 +1,19 @@
+volatile int cnt0 = 0; // Digitaler Pin 2 und 3
+volatile int cnt1 = 0;
+
+void setup()
+{ attachInterrupt(0, doCount0, CHANGE);
+ attachInterrupt(1, doCount1, CHANGE);
+ Serial.begin(9600);
+}
+
+void loop()
+{ Serial.print(cnt0);
+ Serial.print(" - ");
+ Serial.println(cnt1);
+ delay(1000);
+}
+
+// Dummy interrupt functions
+void doCount0() { cnt0++;  }
+void doCount1() { cnt1++;  }