Tagged: hobby RSS

  • Piterwilson 7:30 pm on September 25, 2009 Permalink | Reply
    Tags: , hobby   

    Learning Arduino – Project 1 – Blinking LEDs 

    [ Update : I have resolved my confusion regarding the resistor color band system after i found out that there are actually 3 types of system : 4,5 and 6 band. My particular resistor is a 5 band, and it's color code brown-green-black-black-brown does in fact correspond to 150 with 1% tolerance. This page was useful to find out about this 3 different systems ]

    After the installation of the Arduino board, exercise number 1 dictates the easiest of tasks : make those damn sexy lights turn on and off on command.

    The lesson i followed can be found on this manual under project 1 “LED FLASHER” (By the way, what’s up with that font they use in the beginning of each project? Why are Arduino boards all “street like” all of the sudden? ). This project is just a variation of the test you do to confirm that your Arduino board is in correct working order, The “Blink” example. The only difference is that you are using a different pin number for your digital output and that you are involving the solderless breadboard included with the kit and you are introduced to the idea that you have to use resistors in front of your LEDs to keep them from blowing up. The concept seems easy enough but honestly im having some trouble with the color coding on the resistors.

    Maybe im getting old and my eyes are starting to fail me, but the first problem i had is that the “lines” that note the capacity of the resistors are too small. Maybe i need to add a magnifying glass to my Arduino hobby kit. The second problem, or confusion i have, is that i have used the 150ohm resistor that comes clearly marked and included with the kit, just like the manual says, and that ,according to the color coding chart and these google image results, should have brown-green-brown lines plus the quality and tolerance lines. Instead this little guy, seems to have brown-green-black-black-brown lines.

    sos_2

    I know this is the right one because the plastic bag said so and because this worked and the LED didn’t blow up, but from what i can tell, the shades of the colors and even the distribution of these lines are not really that standardized, which would beat the whole porpoise of having a color code system. Maybe it would have been better to just write down the actual numbers on the resistors?

    In any case the whole project took just a couple of minutes to complete and there i had an LED blinking 1 second on and 1 second off. Because i was bored but didn’t feel confident enough to start project 2 i decided that i would do something a bit more exciting with this first skill of making happy shinny lights go on and off. I thought about making a morse code machine to broadcast my SOS distress signal of confusion regarding the resistor to make myself feel better about the whole thing. Using the info on the morse code wikipedia page it wasn’t long before i had my red little LED asking for help with little bursts of light going on into the Buenos Aires night.

    sos_1

    The code i ended up with looks like this:

    // SOS I'm a n00b
    int ledPin = 10;
    int unitLength = 100;
    void setup(){
      pinMode(ledPin,OUTPUT);
    }
    /*short mark, dot or 'dit' (·) — one unit long*/
    void shortMark(){
      digitalWrite(ledPin,HIGH);
      delay(unitLength);
    }
    /*longer mark, dash or 'dah' (–) — three units long*/
    void longMark(){
      digitalWrite(ledPin,HIGH);
      delay(unitLength*3);
    }
    /*intra-character gap (between the dots and dashes within a character) — one unit long*/
    void intraCharGap(){
      digitalWrite(ledPin,LOW);
      delay(unitLength);
    }
    /*short gap (between letters) — three units long*/
    void shortGap(){
      digitalWrite(ledPin,LOW);
      delay(unitLength*3);
    }
    /*medium gap (between words) — seven units long*/
    void medGap(){
      digitalWrite(ledPin,LOW);
      delay(unitLength*7);
    }
    void sayS(){
      shortMark();
      intraCharGap();
      shortMark();
      intraCharGap();
      shortMark();
    }
    void sayO(){
      longMark();
      intraCharGap();
      longMark();
      intraCharGap();
      longMark();
    }
    void loop(){
      sayS();
      shortGap();
      sayO();
      shortGap();
      sayS();
      medGap();
    }
     
  • Piterwilson 6:02 am on September 4, 2008 Permalink | Reply
    Tags: , hobby   

    Pie Chart example in AS3 

    Download source

    A sample class to make a dynamic pie chart in Actionscript 3, it includes a sample Tooltip class.

     
    • Murray 8:11 pm on November 13, 2008 Permalink

      Hey! Since you helped make FLipbook! in benetton, I was wondering if you know why I can’t sign up for benetton. I’ve tried it a few times now, but after i finish the form, it says “an email has been sent your address”. But it’s never in my inbox! I know I spelled it right too. Do you know why? My email is garymatic@gmail.com.

    • Vishal Chander 4:44 pm on April 6, 2009 Permalink

      Gr8 Job dude…i’m goin to study this code and help u in future chages

    • Nico 4:38 pm on April 4, 2010 Permalink

      Thanks a lot for this code man!!!!
      You saved me at least 10 hours of work!!!

      thank you!

    • Tony 7:58 pm on April 29, 2010 Permalink

      Hey Piter,
      This is great work! However, I was wondering if there was a way to display the labels automatically without having to mouseover the piechart? Any suggestions?

    • Gorjan 11:01 am on October 2, 2010 Permalink

      Thank you for this. I am on a deadline and this code saved me :)

    • Juan David 3:59 am on October 6, 2010 Permalink

      Gracias parcero !, me salvaste a mi tambien, saludos y salud

    • John 1:53 am on November 9, 2010 Permalink

      Hi Peter,

      Thanks for the tip. I am kind of new to actionscript, so I am struggling to change the text typeface. I tried to change the style sheet, but whenever I do, it gave me the error. I want to change the typeface especially when I rollover the piechart. Can anyone help me out?

    • Crah 5:02 pm on November 9, 2010 Permalink

      im having trouble with this code am i suppose to make a movie clip for the pie chart. can some one help thanx u

    • BEGIINER 5:52 am on May 30, 2011 Permalink

      How to change font size??

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel