Tuesday, March 10, 2009

Lads-have-a-cold-shower

software.

on this page are the steps to follow to install the software.

Once installed we can start a program, remember that it is in C, the most instructions are typical of C (you can see several tutorials in the "downloads" "programming" ... although some instructions are exclusive Arduino :

true / false :

is a constant that defines the logic state. FALSE is simply 0, while TRUE is any number other than 0, regardless of the type.

high / low :

These signals define the levels of the integrated pin to ON (high ) = 5 v OFF (low ) 0v.

digitalWrite (13, HIGH )

This line enables the program pin 13.

Input / output :

is used within the instruction pinMode (), defines pin as input or output.

pinMode (13, OUTPUT )

pinMode ( pin, mode):

inside the loop is used setup () and defines the behavior of pin between input and output.

pinMode ( pin, OUTPUT ) / / set "pin " as output.

In the Arduino digital pin are configured by default as inputs, so no need to explicitly declare that as inputs.

should also put an internal pullup resistor to 20k which is accessed by software. This is useful when connecting actuators or buttons.

access pullup resistor :

pinMode ( pin, INPUT )

digitalWrite (pin , HIGH);

When configure a pin as an output it can provide 40 mA to other devices or circuits, enough to light a LED with the corresponding resistance, but not to activate a relay, motor, etc.

If you connect a device that consumes more than 40 mA or shorted outputs can burn the chip.

It is often advisable to connect a resistor between pin output and receiver 470Ω resistor to 1K.

digitalRead ( pin ):

Lee the value of an input pin which resulted HIGH (enabled) or LOW (disabled). " pin "can be configured with a value of 0 to 13.

Dato = digitalRead (10), Saves "fact" state of input 10.


digitalWrite (pin , value):

puts the exit to HIGH (enabled) 5v or LOW (disabled) 0v, the As a digitalRead pin can assign a value between 0 and 13.


analogRead ( pin):

Lee an analog value with 10 bit resolution. This only works in analog pin 0 to 5. The result d ela reading is an integer with range 0 to 1023.

not need to declare them as inputs as they only work as such.


digitalWrite (pin , value):

Arduino In the new work in pins 3,5,6,9, and 10, marked as PWM (pulse width modulation), the value is assigned to an integer between 0 and 255.

A value of 0 generates a stable value of 0 volts on pin indicated, 255 generates a value of 5V. For values \u200b\u200bbetween 0 and 255 generated different trains of pulses to cause the same effect as if you were using an analog voltage of a value between 0 and 5. For example, with the number 128, if applied to a Led its appearance would be half lit.

analogWrite (10, 200), / / \u200b\u200benable pin 10 with the corresponding PWM signal .

not need to declare the analog outputs as such.
The following example reads an analog signal and converts it into a value for the output:

led int = 10, / / \u200b\u200bLED on the pin 10. Int

pin = 0, / / \u200b\u200bthe potentiometer is connected to this input.

int value; / / space where we store the data.

void setup () {} / / no need setup.

Void loop

{value = analogRead ( pin ) / / reads the value of pin 0 and stores it in "value."

value = value / 4; / / convert input 0 to 1023 with 0 to 255.

analogWrite ( led , value); / / enable PWM output for "value."

}

delay (ms ):
For the program based on the number of milliseconds.

Delay (1000), / / \u200b\u200bfor a second.

millis ():
Returns the number of milliseconds since the program began operating today, is a long integer.

Value = millis () / / load value the number of milliseconds.
This value is reset approximately every 9 hours.

min (X, Y):
Calculates the minimum of the two numbers and returns the child.


max (X, Y):
Calculates the maximum of the two numbers and returns the largest

0 comments:

Post a Comment