#teensy!!!! in pullup!!!!
Explore tagged Tumblr posts
Note
is there something you need to tell mommy, sweetheart?
mmm 😖😖😖 mommy I feel embarrassed >_< i- I gotta-
no it's FINE I'm FINE everythings okayyyyy I am being so big
#hands holding#might have. gone. a teensy bit#teensy!!!! in pullup!!!!#but I pleaseeeeeee#omo#omorashi#live hold
3 notes
·
View notes
Text
Coin Slot
#define LEDPIN 13 // Pin 13: Arduino has an LED connected on pin 13 // Pin 11: Teensy 2.0 has the LED on pin 11 // Pin 6: Teensy++ 2.0 has the LED on pin 6 // Pin 13: Teensy 3.0 has the LED on pin 13
#define SENSORPIN 4
// variables will change: int sensorState = 0, lastState=0; // variable for reading the pushbutton status
void setup() { // initialize the LED pin as an output: pinMode(LEDPIN, OUTPUT); // initialize the sensor pin as an input: pinMode(SENSORPIN, INPUT); digitalWrite(SENSORPIN, HIGH); // turn on the pullup
Serial.begin(9600); }
void loop(){ // read the state of the pushbutton value: sensorState = digitalRead(SENSORPIN);
// check if the sensor beam is broken // if it is, the sensorState is LOW: if (sensorState == LOW) { // turn LED on: digitalWrite(LEDPIN, HIGH); } else { // turn LED off: digitalWrite(LEDPIN, LOW); }
if (sensorState && !lastState) { Serial.println("Unbroken"); } if (!sensorState && lastState) { Serial.println("Broken"); } lastState = sensorState; }
First a prototype of the coin slot was made out of cardboard and from there a model was made in Fusion 360. The first version needed a few extra parts to work and a second version was made to allow a spring to pull it closed after a coin was pushed in. The sensor for the coin slot was a break beam and only read if it was broken or not, because our coins were washers with a hole it would be tripped twice but this wasn’t a problem with our code. It still ran the animations only once.
-Alison, Physical Computing
0 notes
Text
Teensy Hat Controls Games
[Carson] didn’t know how to use an accelerometer until he wired one up to a Teensy and put it all in a hat. The result is a joystick that will probably cause you neck problems if you play video games for very long. You can see a video of how the device came to be and how it works, below.
We liked the approach of building up the circuit and testing it before integrating it with the hat. He used a small breadboard with half the Teensy pins hanging off. That seems to work, although we’d be worried about something shorting or floating pins causing issues. Of course, if you drove the disconnected pins as outputs or inputs with pullups that might not be a big deal.
A lot of the video is focused more upon the setup of the custom controller for some specific games, but it did seem to work well. We couldn’t help but be envious of anyone who can move their neck that much without aches and pains.
The controller didn’t seem very practical, if we’re honest, although he did get a little better at using it by the end of the video. It was a fun way to experiment with an accelerometer, however it would probably be nice to add a battery and some wireless communication so that you aren’t trailing a cable.
The code is available via Pastebin. About the biggest takeaway from that was the need to program a dead zone so that tiny movements don’t turn into control inputs.
If you are more interested in how these accelerometers work — which is quite interesting — [Bill Hammack] has just the video for that. If moving your head isn’t really your cup of tea, you can use the same ideas for gesture control, as well.
youtube
Teensy Hat Controls Games was originally published on PlanetArduino
0 notes
Photo
Sparkfun 2x2 button pad: testing the buttons
Switch
VCC
Switch gnds
10K resistors (pullup)
gnd
Input pins on Teensy
0 notes
Text
Multiplexer MIDI pushbuttons test - code
#include <C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\MIDI\MIDI.h> #include <midi_Defs.h> #include <midi_Message.h> #include <midi_Namespace.h> #include <midi_Settings.h>
/****************************************************************************** Hacked together by Thomas Stonehouse 05/07/17 For Teensy 3.2 with 8x pushbuttons attached to 10K pullups (to ground)
Also including MIDI code from here https://ask.audio/articles/how-to-build-a-simple-diy-usb-midi-controller-using-teensy
Mux_Analog_Input SparkFun Multiplexer Analog Input Example Jim Lindblom @ SparkFun Electronics August 15, 2016 https://github.com/sparkfun/74HC4051_8-Channel_Mux_Breakout
This sketch demonstrates how to use the SparkFun Multiplexer Breakout - 8 Channel (74HC4051) to read eight, separate analog inputs, using just a single ADC channel.
Hardware Hookup [EDITED FOR TEENSY]: Mux Breakout ----------- teensy S0 ------------------- 0 S1 ------------------- 1 S2 ------------------- 2 Z -------------------- 3 VCC ------------------- 3.3V GND ------------------- GND (VEE should be connected to GND)
The multiplexers independent I/O (Y0-Y7) can each be wired up to a potentiometer or any other analog signal-producing component.
Development environment specifics: Arduino 1.6.9 SparkFun Multiplexer Breakout - 8-Channel(74HC4051) v10 (https://www.sparkfun.com/products/13906) ******************************************************************************/ const int MIDI_CHAN = 1; //set MIDI channel const int NUM_OF_BUTTONS = 8; const int MIDI_NOTE_NUMS[NUM_OF_BUTTONS] = {60, 62, 64, 65, 67, 69, 71, 72}; // C4 D4 E4 F4 G4 A4 B4 C5 const int MIDI_NOTE_VEL = 100; int buttonState[8]; //array to store state of each button
///////////////////// // Pin Definitions // ///////////////////// const int selectPins[3] = {0, 1, 2}; // S0~2, S1~3, S2~4 //const int zOutput = 5; UNUSED const int zInput = 3; // Connect common (Z) to 3 (digital input)
void setup() {
for (int i=0; i<3; i++) //set up mux channel select pins { pinMode(selectPins[i], OUTPUT); digitalWrite(selectPins[i], HIGH); } pinMode(zInput, INPUT); // Set up Z as an input
for (int i=0; i<8; i++) //set all button states as LOW to start { buttonState[i] = 0; } Serial.begin(9600); // Initialize the serial port // Print the header: Serial.println("Y0\tY1\tY2\tY3\tY4\tY5\tY6\tY7"); Serial.println("---\t---\t---\t---\t---\t---\t---\t---");
}
void loop() { // Loop through all eight pins. for (byte pin=0; pin<=7; pin++) { { selectMuxPin(pin); // Select one at a time int inputValue = digitalRead(zInput); // and read Z { if (inputValue != buttonState[pin]) //if button state has changed { if(inputValue == HIGH) //if button is pressed { usbMIDI.sendNoteOn (MIDI_NOTE_NUMS[pin], MIDI_NOTE_VEL, MIDI_CHAN); Serial.print(String("ON ") + "\t"); } else //if button is not pressed { usbMIDI.sendNoteOff (MIDI_NOTE_NUMS[pin], 0, MIDI_CHAN); Serial.print(String("OFF") + "\t"); } } else //waiting for change of button state { //Serial.print(String(buttonState[pin]) + "\t"); //can also be used to debug variables Serial.print(String("???") + "\t"); } } buttonState[pin] = inputValue; //set new state for current button } } Serial.println(); //send all button states to serial monitor }
// The selectMuxPin function sets the S0, S1, and S2 pins // accordingly, given a pin from 0-7. void selectMuxPin(byte pin) { for (int i=0; i<3; i++) { if (pin & (1<<i)) digitalWrite(selectPins[i], HIGH); else digitalWrite(selectPins[i], LOW); } }
0 notes