Skip to content

Instantly share code, notes, and snippets.

void setup() {
Serial.begin(9600);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
digitalWrite(6, LOW);
digitalWrite(7,LOW);
}
/*
Test Code for UMLshield
-- use digitalRead to check that buttons on pins 2 and 6 function
-- use analogRead to check the function of the pots on pins A0 and A2
-- use map function to provide position values for servos connected to pins 3 and 4
No jumpers are required
*/
#include <Servo.h>
/*
* UML shield
* Test code for
* array of LED's connected to digital I/O pins 2, 3, 4, 5, and 6
* test LED connected to digital I/O pin 13
* common cathode RGB LED connected to digital I/O pins 9, 10, and 11
*
* Board configuration: Jumper JP3 closed
*/
@navillus5
navillus5 / MECH 2010 Stepper 2
Created March 23, 2017 14:45
Test code for operating a bipolar stepper motor in the higher torque mode using two active coils
int d = 5;
int count = 0;
void setup() {
Serial.begin(9600);
Serial.println(count);
// coil 1
pinMode(11,OUTPUT); // enable pin for coil 1
@navillus5
navillus5 / testLEDs
Created October 30, 2016 01:56
UMLshield test code - LED array
/*
* UML shield
* Test code for array of LED's connected to digital I/O pins
* 2, 3, 4, 5, and 6
*
* Board configuration: Jumper JP3 closed
*/
// Create a six element integer array for the pin numbers
// The UML shield has 6 LEDs which can be used to display 6 bits of data
// The highest binary number that can be represented is 111111 which is the
// integer value 63.
int binValue[] = {0,0,0,0,0,0};
int ledArray[] = {2,3,4,5,6,7};
int val = 0;
void setup() {
Serial.begin(9600);
int ledPins[]={2,3,4,5,6,7};
int vol = 0;
void setup() {
for(int i=0; i < 6; i=i+1){
pinMode(ledPins[i],OUTPUT);
digitalWrite(ledPins[i],LOW);
}
Serial.begin(9600);
int ledPins[]={2,3,4,5,6,7};
void setup() {
for(int i=0; i < 6; i=i+1){
pinMode(ledPins[i],OUTPUT);
}
}
@navillus5
navillus5 / IR Remote 1
Last active April 4, 2017 13:55
Arduino IR Remote sample code
/*
* Having used the sketch IRrecvDemo from the IRremote library to
* determine the codes for four buttons on a remote, this code will
* now "listen" for these codes and control LEDs based upon what code
* has been received.
*/
#include <IRremote.h>
@navillus5
navillus5 / Timer1 Example A
Last active April 4, 2017 14:01
Timer! example 0
/* This example employs Timer1 to blink one of three LEDs. The timer is initialized and called
during the setup() function which repeatedly calls a function that alternately flashes the
other two LEDs. The timer function continues without interruption when the loop operates.
*/
#include <TimerOne.h>
// This example uses the timer interrupt to blink an LED
// This allows the main program to do "other stuff"