Tagged: arduino Toggle Comment Threads | Keyboard Shortcuts

  • Yury Gitman 5:53 pm on October 8, 2011 Permalink | Reply
    Tags: arduino, , cookbook, homework,   

    Arduino Cookbook Reading/Homework 

    Come to Oct 7th’s Class having done and read:

    Review: 1.1-1.5   [Read it for what you don’t know]

    Variables Introduced:  2.0-2.2

    Doing Math to Variables: 3.0-3.2

    Serial Comm Intro: Read 4.0 and don’t worry if over your head. Do pay close attention to 4.1.

    More Fun with Variables, Relational Operators: 2.17

    *Switches Intro, with Pull-Up Resistor and De-bouncing: Read 5.0 and 5.1, Do 5.2 and 5.3

    “If” and “Else If” Statements Intro: 2.12

    *”While” and “For” Loop: Pages 2.13, 2.14


    Come to Oct 14th’s Class having done and read:

    2.4:   Arrays Introduced (for Switches and LED’s)

    2.10:   Functions: Pages

    7.1:  LED’s Introduced and Reviewed

    7.6:  Making Knight Rider

    2.15-2.16:  Break and Switch Case:

    5.4:   Switches Intermediate:

    2.19, 2.21:  Logical Operators on Variables:


    1)  Change LED Blink Delay based on Amount of time Button is pressed.

    2)  Make 6 Different Light Sequences with  3-4 Switches and 4 LED’s.  Use Logical Operator, Knight Rider Effect, Functions and/or Switch Cases.


    Come to 21st’s Class having done and read:

    Reading Analog Values: 5.6,

    Map Function: 5.7

    Sensor: 6.0-6.3

    LED Fading, Color, and Control: 7.0, 7.2, 7.4, 7.5, 7.6



    Show 7.4 and 7.5 in Class.

    • hirumi 4:21 pm on October 14, 2011 Permalink | Reply

      Most useful/valuable exercises:
      I found that using the serial input to be the most useful exercise from the homework. It was gratifying to see the computer communicate with the arduino. Functions was a useful read because it made my code more modular and clean.

      Most difficult:
      Both switchTime sketches made me want to bash my head into a wall. I couldn’t get them to work to save my life. I kept getting errors even though it seemed like I had copied the examples exactly from the book. I’m not sure if there was a typo, or if there was some sort of additional code I was supposed to know to include, but regardless I couldn’t troubleshoot the issue.

    • noadol 4:24 pm on October 14, 2011 Permalink | Reply

      Most useful and valuable:

      Functions && Logical Operators on Variables.

      These two exercise really pushed my understanding of code structure
      and expand my options to control conditions.

      Most difficult and confusing:

      (5.4) Determining How Long a Switch Is Pressed:
      I could get the code text and structure, but I was confused about what it’s supposed to do or how it’s functions.. I’m not sure I got the point of this assignment, meaning I won’t be able to apply it and develop it in other projects.

      Formatting Serial Communication:
      It was very technical, a lot of new expressions I’m not sure what’s their value (e.g. ASCII, BYTE, BIN..).

    • mayaweinstein 4:24 pm on October 14, 2011 Permalink | Reply

      I found the section on breaks helpful. It’s good to know how to break a for loop without ending the function. I also found the section on RGB led’s helpful, it was a good introduction on how to use RGB led’s.
      I was really confused by the section covering the switch-case function. I understand what a function is and how it works but I did not understand what was being accomplished through the use of the switch-case. I was completely lost when it came down to the bitwise operations. I have no idea why you would be working with what looked like binary code in arduino. I’m not sure exactly what the code was trying to do or when you would actually use it.

    • Catalina Cortazar 4:25 pm on October 14, 2011 Permalink | Reply

      The codes I found more difficult and confusing were the following:

      The example blink3 on the function part. The function that needs a parameter and gives 1 return value. I couldn’t get it to work at home and also don’t understand how and when do we call the function. Do we need to call it from inside the void loop?

      Another thing that I still found confusing is the pull up button. They always start HIGH ? How do we do it to turn the light off, or maybe is there a way to change the state of the button?

      I also don’t understand what the value >>= 2; means (shift value right to places)

      Most useful or valuable

      The most useful and valuable thing I found was the use of arrays in order to declare more than one element. I also think it’s useful the logical operators and comparison, in order to give “instruction” to what and when to do something.

      Another thing I found useful is the use of break;
      specially when we have lots of information and we don’t want to use infinitive number of if, else if commands.

    • mónica arias. 4:25 pm on October 14, 2011 Permalink | Reply

      – Both sections regarding logical operators on variables. I had never seen it explained in so much detail, but at the same time in a concise way. They weren’t exercises per se, but it was one of the most helpful chapters. (2.19, 2.21: Logical Operators on Variables)

      – 2.4: Arrays Introduced (for Switches and LED’s): The book makes a fine job explaining it, so it might be just a personal issue I have against arrays in general.
      – 2.15-2.16: Break and Switch Case… yeah. I understood the concept, BUT I still don’t feel comfortable explaining it, or doing it. But hey, isn’t experimentation key? I’m sure that if I spend more time on it, I would eventually get it.

    • dss49 4:26 pm on October 14, 2011 Permalink | Reply

      I guess I neglected some of the reading although I found a very helpful tutorial online that sort of walked me through basic input/output using buttons and LED’s. (I’ll be sure to stay on top of it in the future). The link can be found at http://www.ladyada.net/learn/arduino/lesson5.html.

      Essentially they create a problem set starting with basic switch functions… helping build the code ground up for recognizing change in state and output controls. Towards the end they give you a series of problems involving a Bike company that needs help programming a new lighting system. The various stages of the prompt test your abilities and end with the creation of a light system which has 4-5 separate modes activated by the button. This piecemeal way of learning was personally very helpful.

      There were a number of other tutorials that I found helpful, one of which explained the use of millis() instead of delay(). By using millis() as a timer instead of delay(), one is able to nest other functionality within conditionals that otherwise would not be able to run with delay() since delay() stops all processes within the Arduino. A notable example would be having one LED blink 500ms after another has started blinking, creating a sort of Lag effect. Using delay() would prevent you from activating another LED while the former is being delayed. Another use of millis() was creating a stopwatch which blinks as a timer begins… the push of a button turns the timer off, the start and end times are calculated as Serial.println spits out the time.

      • dss49 4:28 pm on October 14, 2011 Permalink | Reply

        debouncing was helpful as well.. making sure both readings of the input were consistent.

    • yonglee2011 4:27 pm on October 14, 2011 Permalink | Reply

      Two Exercise that I like or helpful:
      The custom function for different Blinks are good sample of diverse options we can use. I wish the codes are more detailed, so it is easy to follow on the Arduino. I type the code from the book, but the code didn’t work.

      Conditional section show diverse conditional options. But I wish the conditional section has more sample codes.

      Difficult exercise:

      There are some samples of using arrays. I played with Arrays, and wish there are more samples to look up. I found the book is helpful, but it seems it doesn’t have depth details.

      I really like what While and For Loop do, and wish there are more exercise to help a stater to understand the concepts and samples.

    • mrcansler 4:27 pm on October 14, 2011 Permalink | Reply

      The two readings I found most interesting were 2.10 (Functions), and 2.19 (Logical Operators). Until this point, I was unaware that functions even existed within this programming environment, and they appear to be a useful resource when constructing larger sections of code later. The logical operators sections was useful, as they are actually very basic concepts, but I was not particularly familiar with these basics. Still feel like I’m playing catchup with Syntax.

      I had some difficulty with arrays, as I feel like I completely get them structurally, but whenever I try to implement them I always seem to mess up the for loops associated with counting through them. I’m also having a bit of trouble digesting 2.16 “Switch”, and figuring out when to use these vs if/else statements. Is there a specific number of inputs before it’s best to use SwitchCase?

    • Aneta Genova 4:27 pm on October 14, 2011 Permalink | Reply

      I found most useful the array reading and exercise.It makes working with many variables extremely easy and certainly shortens the code. I developed a project about bouncing animals in a field and the array list was the easiest way to do them.

      I found very easy the functions reading and exercise. The first exercise about blinking and delay was very familiar to sketches we’ve done in class.

      I found challenging the logical operators and logical comparisons and I definitely get confused when we get to compare strings. I was not able to do that assignment.

    • jasonkim1006 4:27 pm on October 14, 2011 Permalink | Reply

      1. Which two exercises or code did you find most useful or valuable from the reading? Be as specific as possible.

      a) The first code I found to be very useful was the case / break code. It was really interesting to get input from the serial monitor and make the LED blink.
      char ch = Serial.read();
      case ‘1’:
      Serial.println(“blink once!”);
      for(int i = 0; i<4; i++){

      Using default, we can set the default input and by using the switch case, we can use any key on the keyboard to create an input and make, for example, an LED blink sequence. Just by using the case '1':, case '2':, etc. we can determine how many different types of sequences we want.

      b) The second code I found very useful were using logical operators such as and (&&), or (||), and not (!). By using logical operators, we can determine diverse situations such as if both switches are pressed, both the switch and the tilt sensor are sending input, either the first button or the last button is pressed, etc. By including logical operators, there can be so many different types of situations with just four buttons. Instead of making one button do one thing, we can make a combination of one, two, three, or four buttons to something else. The logical operators are also good for setting up boundaries or giving certain conditions to inputs.

      2.Which two exercises or code did you find most difficult or confusing from the reading? Be as specific as possible.

      a) The first code that was really difficult to understand was calculating the amount of time using the switchTime() function. It was really hard to understand because whenever I tried it, the counter would increase rapidly or even decrease to a high negative number. I want to try using the "long" and "millis()" more so that I can understand its concept better. Because we used pullup resistors inside the Arduino, the HIGH and LOW was also a bit confusing to understand. The state should be inverted when using different resistors.

      long switchTime(){
      static unsigned long startTime = 0;
      static boolean state;

      if(digitalRead(inPin) != state){
      state =! state;
      startTime = millis();
      if(state == LOW){
      return millis() – startTime;
      return 0;

      b) Related with the switchTime() function is the debounce code. It took me a long time to understand the debounce code by using booleans of state and previousState. I think it was especially hard to understand because the debounce does not actually give direct feedback. Switch codes worked without having to use the debounce code and therefore it was at first hard to understand what "debouncing" actually did to my code. Later did I find out it was just a check for a few milliseconds to see if the button was stable enough to input and output information. It was a comparison between the current state and previousState and to see if they were equal.

    • litchirhythm 4:29 pm on October 14, 2011 Permalink | Reply

      ● The most useful exercise would be 5.4, the switch timer, for sure. It shows how to use timing (millis() function) to count how long you push the button and make led lit up in relative amount of time.

      And the other one that is interesting is 2.16 on the ‘switch’ logical command which I never know before. It function can be written with a long list of if statement but switch can be really handy on another person (or yourself) to read and understand the code much easier.

      ● The most difficult would also be the 5.4, the switch timer, since the first homework assignment is to tweak this one to make it blink. So I have to know this code inside out to be able to tweak it. In it, I have to apply the concept of custom function that count the time and return the data back to the main loop (the concept from 2.10 the function block), It’s like a wrap up of all exercises.

      Another thing that I find most difficult is Array (2.4). Even we have saw some of them on the example we work on. But to read and understand all of the concept and remember the syntax so that I can think and make it to work in the way I want is still hard. Because you’ll have to use a for loop to run the arrays all the time. But I think I understand it much more now.

    • josefayala 4:33 pm on October 14, 2011 Permalink | Reply

      I liked the vast majority of the tutorials. My favorite was Arrays because in the past I have not been able to properly execute them. There is something gratifying about making 100 ellipses with 3-4 lines of code (otherwise we’d have to hard code each ellipse). With regards to Arduino work it’s nice to know that I can call on a group of pins for one purpose by simply calling an array. What I was surprised to find out is that the array can hold a string of characters. I found that character strings are good possibly for Serial Monitor work. Functions were also a good time, and it was good to get a good look at the use of parameters and returns.

      Switch statements can be difficult, but overall the concept is well embedded into my mind. I understand the importance of using breaks within a switch command but kind of miss the logic of setting it up with what seem to be all the arguments wrapped between the switch (I guess from the purpose of switching). Is it comparable to an array ? Who knows…I guess I have to re-read it.


    • aisencc 5:02 pm on October 14, 2011 Permalink | Reply

      10/14 Reading Assignment Response
      The easiest sections from the readings were the Arrays Introduced and Logical Operators. Both of these sections are reviews to the Processing and Arduino IDEs. Both of these sections seemed a bit redundant, since it is crucial to know these in order to create any functions or when working with a variety of pins that are programmed to do similar things. For the homework assignment I used both of these methods in structuring my code. Every time I use these

      The most challenging chapters were Determining How Long a Switch is Pressed and Knight Rider. These are not necessarily hard to understand, but more dense than the practical sections I mentioned above. The Knight Rider was not complicated, but it was dense. Understanding arrays makes this section easy, because the use of for loops with the right amount of delay HIGH and LOW patterns is what makes the LED pins blink one at a time. Determining How Long a Switch is Pressed was the most challenging section of the homework because it introduces a counter and functions. I am still having to read it over and over again, to try to understand exactly what it’s doing.

  • josefayala 5:56 am on September 23, 2011 Permalink | Reply
    Tags: 3D printing, arduino, DoItYourself, , New York, New York City, New York Hall of Science, Open source   

    3 Things I Liked At Maker Faire by Josef Ayala 

    Going to Maker Faire this year made me realize how much I REGRET not going to Maker Faire last year in 2010. I had such a really good time all under the impression that I would look at it all and yawn. I will eat those words now, and most likely be at Maker Faire in 2012!!!!! It was not only great to see how people’s minds work but also how everyone attacked their tasks and executed assembly in a very unique way but also good to see a really nice and well rounded community for this sort of event. It was peculiar, interesting, entertaining and nerdy all rolled into one. It was also quite scary to see 8 year olds speaking to me using terms such as “open-source”. When I was 8, “open-source”  didn’t exist and I wasn’t playing around with sensors (See sling shot photograph from my first post)! The world might just have a bright future after all.


    That said, here are some of my favorite exhibits from Maker Faire: VIDEOS COMING SOON!!!!

    1) GetLoFi – Contact Mics:

    These guys were great, I am heavily into anything related to the sound field. Even though, people might have thought that this was a very simplistic setup and effect, I was still greatly surprised by the ingenuity and talent that goes into something like this. After all that they still managed to pull off a very nice aesthetic for these extremely awesome mics. I plan to try to build one for myself in the future. :

    The microphones are “piezoelectric” which essentially means is that they respond by in large to pressure. Piezo electricity contains the ability of some materials to produce a voltage when subjected to pressure—to convert vibrations into an electrical signal.

    2) Drum Machine/Synth TV Set:

    Again, music oriented Arduino projects win me over. I liked this set up because it incorporated what I believe was an Arduino set up to the television set which triggered an Animation on the adjacent television screen. The drum machine had a similar set up which incorporated what I believe was a light sensor which detected the absence of light and triggered different drum sounds based on how you marked up the projector screen disc. It was a fun set up and I got to play Fur Elise and The Entertainer.


    3) 3-D Printing:

    This never ceases to amaze me. It is growing on me more as I am now learning about “parametric design” for products in my Thesis section but overall, it’s nice to see how things are made and processed. Below I believe are examples of algorithmic product development.


    honorable mentions:

    aren’t these helmets cool !?




  • Yury Gitman 2:11 pm on September 10, 2011 Permalink | Reply
    Tags: arduino, , foundations, learning, software, week 3   

    Arduino – Software Foundations 

    Learning   Examples | Foundations | Hacking | Links


    This page contains explanations of some of the elements of the Arduino hardware and software and the concepts behind them.


    • Sketch: The various components of a sketch and how they work.


    • Digital Pins: How the pins work and what it means for them to be configured as inputs or outputs.
    • Analog Input Pins: Details about the analog-to-digital conversion and other uses of the pins.
    • PWM: How the analogWrite() function simulates an analog output using pulse-width modulation.
    • Memory: The various types of memory available on the Arduino board.

    Programming Technique


  • breegeek 7:50 pm on March 21, 2011 Permalink | Reply
    Tags: arduino, data visualization, processing, sensors, sound   

    The story of an Hour 


    Since I was using a microphone as my input and was sampling every 100 microseconds, then updating to a googledocs spreadsheet every two seconds… one day’s worth of data maxed out 200,000 cells in my sheet. Which led me to taking data for one hour only.

    I hooked up my mic as the input to the arduino and took an average every 5 miliseconds, wrote the arduino input to serial in single bytes, then wrote the information from processing to google spreadsheets.

    It worked…kind of? I am not sure if the arduino and the processing talked together accurately, and I should rework that. Another thing I should try to do is use the Xbee directly (without arduino), as a few people have suggested.

    Anyway, here is the sound scape visualized over an hour.

    And the code (there are three main pieces)

    (More …)

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc