Friday, May 1, 2015

Arduino Programming


Arduino Sketching

In his book, Creation by Law, originemologist Joey Lawsin posited a theory claiming that "Everyone and Everything are all Instructions; either they are made up of instructions or they are the instructions."  He named this principle as Scriptionism.

Just like in the world of ants, every individual in the colony is a instruction. Some ants are tasked to gather food. Some act as soldiers. Some as cleaners. Some as guards. Even the queen's job of acting as the mother of all these ants is a task. The actions of foraging, defending, cleaning, guarding, and nurturing - are all instructions. However, each individual too is a instruction. When instructions are combined in a list like a recipe, they form what is called a Procedure

In the Arduino world, instructions or programs are called Sketches. When saved as a file , its extension is.ino. Instructions are entered into the Arduino's text editor. The editor has features for cutting, pasting, searching, and replacing text. Its toolbar buttons allow you to verify and upload programs; create, open, and save sketches; and even open arduino's serial monitor. A complete tutorial about the Arduino Environment can be found at  

Moreover, according to the No Third Option Rule sometimes called The Law of Second Option - everything has two and only two options - either you do this or you do that. Plain and simple! If there is a third option, the option becomes a second option. Thus, there is no such thing as third option. In the world of programming, there are always two options - either you do the first instruction or you jump to the next instruction. Like in the example below, each line is a instruction. Each line is executed one at a time. There is no way that two lines can be executed both at the same time. If so, we are breaking the Law of Second Option or the Rule of No Third Option.

This is a procedure named Set-up:
void setup() {
pinMode(4, OUTPUT); // set up pin # 4

This is a procedure named Loop:
void loop() {
digitalWrite(4, HIGH); // turn the LED on
digitalWrite(4, LOW); // turn the LED off

In the Procedure Set-up, the command setup() is an instruction that tells to setup a pin or a set of pin numbers. The command pinMode(4, output) is another instruction that tells us to specifically setup pin #4 as an output. The curly brackets { } is another instruction that tells us to contain all the instructions in one procedure. The word void is another instruction which means "no value". It is a function that does nothing. Doing nothing is still a instruction.

In the Procedure Loop, the command loop() is an instruction that tells the computer to do all the instructions inside the procedure repeatedly. The command digitalWrite(4, HIGH) is another instruction that sends signals and turns on whatever stuff is on pin# 4. The word HIGH is another instruction that turns ON something like an LED. The word LOW is a instruction that turns OFF something like an LED. The delay() command is a instruction that holdups something for awhile like staying ON or OFF.

The prototype for our 10 arduino projects. 

To build this model, make sure you have the following materials:
1. LEDs, 9 pcs
2. Resistors, 9 pcs, 200 ohms each
3. connecting wires
4. Arduino UNO
5. computer cable

image created by fritzing

Procedure to build the prototype:
1. Insert one end of the resistors one by one to pin 4 to pin 12. 
2. Insert the other ends of the resistors to the bread board as shown above. 
3. Insert the longer sides of the LEDs to the breadboard with the resistors one by one. 
4. Insert the shorter sides of the LEDs to the ground of the breadboard one by one. 
5. Insert one end of the connectingwire to pin GND (see white wire) and the other end to the ground on the breadboard.
6. Connect the cable to the Arduino board and the other end to your computer's  USB.
7. Once done, click the link below and start turning on all leds in project #1.

Disclaimer:  We shall not be liable for any loss or damage of whatever nature - direct, indirect, consequential, or otherwise - which may arise as a result of your use of any information on this website. However, if you are interested in using any of the projects for personal or educational purposes, please inform the author by email. 

Public Domain Notice: Copyright (c) 2000. All rights reserved. This article is part of a book entitled iHackRobot. Copies are welcome to be shared or distributed publicly as long proper citations are observed. Please cite as follows: A Journal of a Creative Mind, Joey Lawsin, 1988, USA.

"The Last Human on Earth will no longer be Human." ~ Joey Lawsin
The Homotronics® and Homodruinos® logos are registered trademarks.
Copyright Biotronics© Inc. iHackRobot®. All Rights Reserved.
Patent Pending. 2000 © ®


No comments:

Post a Comment