Added arduino libs
هذا الالتزام موجود في:
39
libraries/EnableInterrupt/examples/Simple/Makefile
Normal file
39
libraries/EnableInterrupt/examples/Simple/Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
## Arduino Makefile, see https://github.com/sudar/Arduino-Makefile (it's awesome!)
|
||||
#ARDUINO_DIR = /home/schwager/bin/arduino-1.6.8
|
||||
ARDUINO_DIR = /home/schwager/bin/arduino-1.8.5
|
||||
#ARDMK_DIR = /home/schwager/Projects/Arduino/libraries/EnableInterrupt/examples/Simple
|
||||
ARDMK_DIR = /usr/share/arduino
|
||||
#AVR_TOOLS_DIR = /home/schwager/bin/arduino-1.6.8/hardware/tools/avr
|
||||
AVR_TOOLS_DIR = /home/schwager/bin/arduino-1.8.5/hardware/tools/avr
|
||||
|
||||
BOARD_TAG = pro
|
||||
BOARD_SUB = 16MHzatmega328
|
||||
ARDUINO_PORT = /dev/ttyUSB0
|
||||
##BOARD_TAG = 2560
|
||||
##ARDUINO_PORT = /dev/ttyACM0
|
||||
#ARDUINO_LIBS =
|
||||
#AVR_TOOLS_DIR = /usr
|
||||
#
|
||||
#CFLAGS_STD = -g
|
||||
#CXXFLAGS_STD = -g
|
||||
#
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
########################################################################
|
||||
## Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
|
||||
#
|
||||
|
||||
#ARDUINO_DIR = /home/schwager/bin/arduino-1.6.4
|
||||
#BOARD_SUB = atmega1284p
|
||||
#CFLAGS_STD = -g -I /home/schwager/sketchbook/hardware/mighty-1284p-master/variants/standard
|
||||
#CXXFLAGS_STD = -g -I /home/schwager/sketchbook/hardware/mighty-1284p-master/variants/standard
|
||||
#
|
||||
|
||||
#ISP_PROG = usbasp
|
||||
# from boards.txt
|
||||
#BOARD_TAG = mighty_opt
|
||||
#ALTERNATE_CORE = mighty-1284p-master
|
||||
# This is set in the boards.txt file.
|
||||
#F_CPU = 16000000L
|
||||
|
||||
include /usr/share/arduino/Arduino.mk
|
31
libraries/EnableInterrupt/examples/Simple/Makefile-usbasp
Normal file
31
libraries/EnableInterrupt/examples/Simple/Makefile-usbasp
Normal file
@@ -0,0 +1,31 @@
|
||||
## Arduino Makefile, see https://github.com/sudar/Arduino-Makefile (it's awesome!)
|
||||
#BOARD_TAG = atmega328
|
||||
#ARDUINO_PORT = /dev/ttyUSB0
|
||||
##BOARD_TAG = 2560
|
||||
##ARDUINO_PORT = /dev/ttyACM0
|
||||
#ARDUINO_LIBS =
|
||||
#AVR_TOOLS_DIR = /usr
|
||||
#
|
||||
#CFLAGS_STD = -g
|
||||
#CXXFLAGS_STD = -g
|
||||
#
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
########################################################################
|
||||
## Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
|
||||
#
|
||||
|
||||
ARDUINO_DIR = /home/schwager/bin/arduino-1.8.4
|
||||
BOARD_SUB = atmega1284p
|
||||
CFLAGS_STD = -g -I /home/schwager/sketchbook/hardware/mighty-1284p-master/variants/standard
|
||||
CXXFLAGS_STD = -g -I /home/schwager/sketchbook/hardware/mighty-1284p-master/variants/standard
|
||||
#
|
||||
|
||||
ISP_PROG = usbasp
|
||||
# from boards.txt
|
||||
BOARD_TAG = mighty_opt
|
||||
ALTERNATE_CORE = mighty-1284p-master
|
||||
# This is set in the boards.txt file.
|
||||
#F_CPU = 16000000L
|
||||
|
||||
include /usr/share/arduino/Arduino.mk
|
67
libraries/EnableInterrupt/examples/Simple/Simple.ino
Normal file
67
libraries/EnableInterrupt/examples/Simple/Simple.ino
Normal file
@@ -0,0 +1,67 @@
|
||||
// EnableInterrupt Simple example sketch. Demonstrates operation on a single pin of your choice.
|
||||
// See https://github.com/GreyGnome/EnableInterrupt and the README.md for more information.
|
||||
#include <EnableInterrupt.h>
|
||||
|
||||
// Modify this at your leisure. Refer to https://github.com/GreyGnome/EnableInterrupt/wiki/Usage#Summary
|
||||
#if defined __AVR_ATmega640__ || defined __AVR_ATmega2560__ || defined __AVR_ATmega1280__ || \
|
||||
defined __AVR_ATmega1281__ || defined __AVR_ATmega2561__
|
||||
#define ARDUINOPIN 10
|
||||
#else
|
||||
// Pin 7 is useful on Arduino Uno, Leonardo, Mighty1284, ATtiny84...
|
||||
#define ARDUINOPIN 7
|
||||
#endif
|
||||
|
||||
volatile uint16_t interruptCount=0; // The count will go back to 0 after hitting 65535.
|
||||
|
||||
void interruptFunction() {
|
||||
interruptCount++;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
#ifdef MIGHTY1284
|
||||
DDRA=0x0; DDRB=0x0; DDRC=0x0; DDRD=0x0; // set all pins as inputs
|
||||
PORTA=0xFF; PORTB=0xFF; PORTC=0xFF; PORTD=0xFF; // turn on all pullup resistors.
|
||||
#else
|
||||
pinMode(ARDUINOPIN, INPUT_PULLUP); // See http://arduino.cc/en/Tutorial/DigitalPins
|
||||
#endif
|
||||
enableInterrupt(ARDUINOPIN, interruptFunction, CHANGE);
|
||||
}
|
||||
|
||||
// In the loop we just display interruptCount. The value is updated by the interrupt routine.
|
||||
void loop() {
|
||||
Serial.println("---------------------------------------");
|
||||
delay(1000);
|
||||
Serial.print("Pin was interrupted: ");
|
||||
Serial.print(interruptCount, DEC);
|
||||
Serial.println(" times so far.");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////// GORY DETAILS //////////////////////////////////////
|
||||
// This has only been tested on an Arduino Duemilanove and Mega ADK.
|
||||
// It is designed to work with the Arduino Duemilanove/Uno, Arduino Mega2560/ADK, the Arduino
|
||||
// Leonardo, and the Arduino Due. Please let me know how you fare on the Leonardo or Due.
|
||||
|
||||
// To use:
|
||||
|
||||
// 1. You must be using a fairly recent version of the Arduino IDE software on your PC/Mac,
|
||||
// that is, version 1.0.1 or later. Check Help->About Arduino in the IDE.
|
||||
|
||||
// 2. Wire a simple switch to any Analog or Digital pin (known as ARDUINOPIN, defined below)
|
||||
// that supports interrupts. See https://github.com/GreyGnome/EnableInterrupt/wiki/Usage#Summary
|
||||
// Attach the other end to a GND pin. A "single pole single throw momentary contact normally
|
||||
// open" // pushbutton switch is best for the most interrupting fun.
|
||||
// See https://www.sparkfun.com/products/97 and https://octopart.com/b3f-1000-omron-3117
|
||||
|
||||
// 3. When pressed, the switch will connect the pin to ground ("low", or "0") voltage, and interrupt the
|
||||
// processor. See http://arduino.cc/en/Tutorial/DigitalPins
|
||||
|
||||
// 4. The interrupt is serviced immediately, and the ISR (Interrupt SubRoutine) modifies the value of
|
||||
// the global variable interruptCount. Open Tools->Serial Monitor in the IDE to see the results of your
|
||||
// interrupts.
|
||||
|
||||
// 5. Peruse the Examples directory for more elaborate examples.
|
||||
|
||||
// 6. Create your own sketch using the EnableInterrupt library!
|
||||
|
المرجع في مشكلة جديدة
حظر مستخدم