Arduino Woe

Lately my Arduino’s been giving me terrible problems, it would take absolutely AGES to start up, and then once it did, the moment I clicked on the “Tools” menu it would freeze for about 10 minutes before the menu would pop up. Not good. anyway, after a long time of Google searching and then giving up and then resuming my searching for a solution I recently came upon a post in the Arduino forums here which had the answer. It seems that by having a Bluetooth module attached to my computer (for Salling Clicker, a GREAT piece of software) the Arduino IDE was constantly searching through the COM ports for an Arduino BT or one of the COM ports, a Bluetooth one most likely, was giving it something unexpected.

Happily I just had to disable my Bluetooth adapter and suddenly it all worked. So to try I tested the following piece of code:

/*
Test of interrupts and clock
(CC) 2007 TheFallenIndustries
Complies to around 2032 kilobytes and needs an ATMega168
*/

#include <FrequencyTimer2.h>

unsigned long freq = 667; // f = 1/T so 1.5kHz is about 667uSec
int val = 0;
int analogPin = 5;
int pin = 13;
int capdump = 7;

void setup()
{
pinMode(11,OUTPUT); // clock is on io pin 11
pinMode(7,OUTPUT); // capacitor dump
pinMode(2,INPUT); // the interrupt input
attachInterrupt(0, fire, RISING); // 0 is pin2, 1 is pin3
FrequencyTimer2::setPeriod(freq);
FrequencyTimer2::enable();
}

void loop()
{
val = analogRead(analogPin);
if(val >= 1000) // Capacitor Charged
{
FrequencyTimer2::disable(); // stop charging
}
else // Capacitor Discharged
{
FrequencyTimer2::enable(); // start charging
}
}

void fire()
{
if(val >= 1000)
{
digitalWrite(capdump,HIGH);
}
}

This seemed to work fine, so I’m expecting a flurry of Arduino experimenting soon. Hopefully I’ll get some LCD displays running in both 8 bit and 4 bit mode.

Another blog I’ve come across recently is http://www.uchobby.com/ It would seem that should you link to this guy’s site, or write an article about hobby electronics, he will send you a kit or a PCB for free. In the past it has been LCD displays but recently it has all been Arduino themed. I found a particular article that was very interesting as I’ve been tryign to convert my La Fonera’s into embedded device servers. However some of the articles are not as complicated, for example this about sorting through large “lucky bags” of components.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: