This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <EEPROM.h> | |
int led = 12; | |
int stored; //data stored in EEPROM | |
int address = 0; //location in EEPROM | |
void setup() { | |
Serial.begin(9600); // sets up serial communication at 9600 bitss per second | |
pinMode(led, OUTPUT); | |
stored = EEPROM.read(address); // reads the data stored in address 0 and assigns to variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <EEPROM.h> | |
byte led = 12; | |
int timesReset = 1; //data stored in EEPROM | |
byte address1 = 0; //location in EEPROM | |
byte address2 = 1; | |
byte retrieved; | |
void setup() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//avr direct port addressing | |
void setup(){ | |
DDRD = B10000000; //digital 7-0 //7 is output here | |
DDRB = B00010000; //digital 15-8 //12 is output here | |
} | |
void loop(){ | |
PORTD = B10000000; //7 high | |
PORTB = B00000000; //all low |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int randnumber; //long is another data type, holds a 32 bit numberfloa | |
void setup() { //set up outputs | |
pinMode(8, OUTPUT); | |
pinMode(9, OUTPUT); | |
pinMode(10, OUTPUT); | |
Serial.begin(9600); //set up serial communication | |
randomSeed(analogRead(0)); //this will make psudo random numbers seem more random | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This sketch demonstrates INPUT_ PULLUP and Interrupts | |
int ledPin = 7; | |
volatile boolean flashy = false; //necessary declaration for passing adjusting global variables with interrupts | |
void setup() | |
{ | |
pinMode(ledPin, OUTPUT); | |
pinMode(2, INPUT_PULLUP); | |
attachInterrupt(0, interruption, FALLING); //attaches interrupt to Digital 2 with internal pull-up resistor | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code for sensing a switch status and writing the value to the serial port. | |
byte switchPin = 2; // Switch connected to pin 2 | |
void setup() { | |
pinMode(switchPin, INPUT); // Set pin 2 as an input | |
Serial.begin(9600); // Start serial communication at 9600 bps | |
} | |
void loop() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// * Simple Arduino Draw | |
import processing.serial.*; | |
Serial myPort; // Create object from Serial class | |
int val; // Data received from the serial port | |
void setup() | |
{ | |
size(800, 500); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
byte kiss = 0; | |
void setup() | |
{ | |
Wire.begin(); | |
} | |
void loop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
void setup() | |
{ | |
Wire.begin(1); //declare device address here | |
Wire.onReceive (beHappy); //acts as interrupt and executed function | |
Serial.begin(9600); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sensorpin = 2; | |
int time = 0; | |
//to hold the time it took for the cap to discharge | |
void setup() { | |
Serial.begin(9600); | |
// For Printing the time it took for the cap to discharge to me | |
} | |
void loop() { |
OlderNewer