Skip to content

Category: Items of Interest

Playing with my Arduino (Board)

Electromagnet Layout
Breadboard and Arduino Electromagnet Layout

The Code:

const int SWITCH = 9; //pin for the MOSFET
const int BUTTON = 7; //pin for the Button
const int LED = 13; //pin for the LED
int val = 0; //used to store state of input pin
int old_val = 0; //used to store previous value of val
int state = 0; //1 = LED off and 0 = LED on

void setup()
{
pinMode(SWITCH, OUTPUT); //Map output to MOSFET
pinMode(BUTTON, INPUT); //Map input to Button
pinMode(LED, OUTPUT); //Map output to LED
Serial.begin(300); //Initiate a data connection between the board and a computer


}

void loop()
{
val = digitalRead(BUTTON); //Read input value of Button and store it

//check for change in value
if ((val == HIGH) && (old_val == LOW)) {
state = 1 - state;
delay(10);
}

old_val = val; //store the old value
if (state == 1) {
Serial.println("OFF"); //send off message back to the computer
digitalWrite(SWITCH, LOW); //turn off flow of electricity to magnet
digitalWrite(LED, LOW); //turn off LED
} else {
Serial.println("ON"); //send on message back to the computer
digitalWrite(SWITCH, HIGH); //turn on flow of electricity to magnet
digitalWrite(LED, HIGH); //turn on LED
}
}

Wait!  Although Arduino may sound like Italian slang for a part of the human body I assure you I’ve been occupying myself in other ways.

You may have heard of the Maker Movement and the wonderful interactive projects prototyped using these versatile little boards.  Well, I finally jumped on board myself.  If you look at the schematics to the right you will see the layout of my very first original project.  About a month ago I was experimenting with home-made electromagnets and posted this video on Youtube.  This weekend I integrated the electromagnet with Arduino controller.  I’ve put together a video demonstration below showing it in action.

If I haven’t plugged it enough in the video, I really got a lot out of Massimo Banzi’s “Getting Started with Arduino” book. I believe it to be a must-read for any noob using these controller boards. The illustrations and examples are very simple to follow. I also referenced the Arduino web site: arduino.cc in the video.


1 Comment

jPlayer is My New Best Friend

I’ve been looking at alternatives to Flash for loading and playing sound files for a while now. Any iPhone user out there can tell you that they still do not support Flash even though there a lot of reports out there that Apple and Adobe are working towards an agreement. I’m somewhat impatient and want my audio clips to be as available to everyone as I can make them. Even iPhone users.

Unfortunately in my search I found no other real cross-browser solution except for Flash. I did find jPlayer though.

When developing this blog template I chose jQuery from all the other javascript frameworks out there because of its ease of use and flexibility. jPlayer is a plugin written for the jQuery javascript framework. It does use a hidden Flash file to play the music, but is controlled through javascript. Since I was already fairly familiar with jQuery, I went with this option. Also, the real beauty of jPlayer is the ability to easily style the player using HTML and CSS. Although WordPress offers some audio support, I wanted something that followed the look and feel of my site.

After incorporating jPlayer and testing it out on the iPhone, I was stunned. My mp3 files were opening and playing when I hit the play button. It appears jPlayer also detects Flash support, just like the SWFObject library. I’ve searched the site and tried to figure out the reason for this, but haven’t discovered it yet. I thought maybe it used the SWFObject library. If anyone knows, I’m curious.

So, I found a way to play my sound files over the iPhone and all is good in the kingdom. If you’re looking at ways to get your flash video or mp3 files to display on iPhone, I suggest checking out SWFObject. If you’re looking for a good customizable audio player that works with jQuery definitely visit Happyworm’s jPlayer site.

7 Comments

Personal Mission

This has nothing to do with PHP or Javascript or any other kind of web technology out there. The last three weeks my family has been waiting to see what the next day brings with much trepidation. My grandfather’s thyroid cancer has returned. He will be seeking radiation treatment and probably chemo soon, but the situation is uncertain. The cancer has spread quite a bit since the last surgery and things don’t look that great.

I am participating in the Relay for Life that helps fund Cancer research. It may not be able to help my grandfather, but it can help the grandfathers, grandmothers, fathers, mothers, and siblings of someone. To me, in a way, it also gives me some semblance of control of his illness. It makes me feel like I can do something in the face of tragedy.

If you would like to help me reach my goal, my fundraising page can be found here. All donations are accepted. It’s the love in which they were given that’s important. You can also join the team if you so desire.

1 Comment

Count Me Converted…

Converted

…converted to Facebook. The Web 2.0 interface has won my heart and mind. It certainly makes MySpace look sluggish and inept as a social networking site. Although MySpace offers more of the ability to modify its look and feel, Facebook rocks its world bar-none.

I like the modular aspect of Facebook. It contains several useful applications which are developed by many individuals from around the globe. For instance I added the application, zuPort: Flickr to my Facebook profile and pointed it to my Flickr feed. Now, it displays all my Flickr photos in a nice, manageable box. Another thing thing that I really dig is the ability to subscribe to your blog feeds. This posting itself will appear in my Facebook profile. MySpace, on the other hand, forces you to use their stupid blogging system instead of giving you any choice as to where you want your blog content to come from. A qualm that I have always had with MySpace is that their advertising is somewhat intrusive and very annoying. On my MySpace profile, as a joke, I put up the results of an on-line questionaire where it proclaimed that I was in fact a lesbian. The next thing I know all the advertising on my profile is for gay and lesbian sites. Facebook just has one little ad on the left side that I barely even notice.

I know Facebook has been along for a while, and I may sound like I discovered the wonders of this web site before anyone else, but I’m just that geeked about it. I don’t know why I overlooked it for so long.

1 Comment