1. Understand Bluetooth
2. Control light/signal
A. arduino -> computer <------- done
B. computer->arduino
ITP Physical Computing Tutorials
RS-232 Protocol
- "a series of standards for serial binary single-ended data and control signals connecting between a DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment)"
- Less complex than USB
- introduced in 1962
Serial port -> receive data->control arduino....hmmm, OSC?
Going through BlueTooth Code:
unsigned int timeout=0;
unsigned char state=0; //probably for direction of communication?
// ISR is not in ATMEGA2560 dasheet. Perhaps keyword for itead?
ISR(TIMER2_OVF_vect) //Timer2 Service ISR= Interrupt Service Routine!
{
TCNT2 = 0; // set timer2 to 0?
timeout++;
if (timeout>61)
{
state=1; //state 1 means timed-out / idle (if state is 1, we write to the serial terminal)
timeout=0; //reset timedout variable
}
}
void init_timer2(void) //initialize ... might just be standard for BT timing
{
//Timer Counter Control Register A
//control the Output Compare pin (OC2A) behavior. pg 187
TCCR2A |= (1 << WGM21) | (1 << WGM20); // compound bitwise or, bitshifted waveform generation mode
TCCR2B |= 0x07; // by clk/1024
ASSR |= (0<<AS2); // Use internal clock - external clock not used in Arduino
TIMSK2 |= 0x01; //Timer2 Overflow Interrupt Enable
TCNT2 = 0;
sei(); // enable interrupts
}
void setup()
{
Serial.begin(9600);
pinMode(2,INPUT); //Direction/state pin
pinMode(13,OUTPUT);
attachInterrupt(0,cleantime,FALLING); //(interrupt, function, mode) where function =ISR, executed on (every or one? ) falling clock
init_timer2();
}
void loop() // main loop .... [insert logic here]
{
switch(state)
{
case 0:
digitalWrite(13,LOW); // Tell pin 13 to be LOW
break;
case 1:
digitalWrite(13,HIGH);
Serial.print("HackerSchool");
break;
}
}
void cleantime()
{
timeout=0;
state=0;
}
Ok, but where's the bluetooth part? ...hmm...
Interfacing Arduino and Python
David got it working with SkyBot, wired. I'm trying to do it at a lower level... Python IRC Client (LL) (More tutorial-like presentation of material here)
SideNotes -
Installed pip and homebrew (a pleehg on ze macPooorts of FEHL)
We had lunch with the Etsy people to day... "Eatsy" :D
Met a woman from Santa Fe!
As you enter the area, there are a couple of small rooms on your left. Perhaps they are offices, but the typewriter is a plushie. Nap room?... Yea, I'd head-desk that.
Giant statue that reminds me of a cross between a Zelda "Deku," a "Save-Owl," and a Yedi. (Don't worry about it, non-n64-gamer folks ;))
In other news, people who compulsively mutter rather worry me.
No comments:
Post a Comment