поискавой системы для электроныых деталей
  Russian  ▼
ALLDATASHEETRU.COM

X  

DEV-12887 датащи(PDF) 21 Page - SparkFun Electronics

номер детали DEV-12887
подробное описание детали  Electric Imp Breakout Hookup Guide
PDF  40 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
производитель  SPARKFUN [SparkFun Electronics]
домашняя страница  https://www.sparkfun.com/
Logo SPARKFUN - SparkFun Electronics

DEV-12887 датащи(HTML) 21 Page - SparkFun Electronics

Back Button DEV-12887 Datasheet HTML 17Page - SparkFun Electronics DEV-12887 Datasheet HTML 18Page - SparkFun Electronics DEV-12887 Datasheet HTML 19Page - SparkFun Electronics DEV-12887 Datasheet HTML 20Page - SparkFun Electronics DEV-12887 Datasheet HTML 21Page - SparkFun Electronics DEV-12887 Datasheet HTML 22Page - SparkFun Electronics DEV-12887 Datasheet HTML 23Page - SparkFun Electronics DEV-12887 Datasheet HTML 24Page - SparkFun Electronics DEV-12887 Datasheet HTML 25Page - SparkFun Electronics Next Button
Zoom Inzoom in Zoom Outzoom out
 21 / 40 page
background image
    } 
else
    { 
        hardware.pin1.write(0);  // Write pin 1 low ­­ LED off
    } 
// This must be called at the end. This'll call loop() aga
in in 10ms, that way it'll actually loop!
    imp.wakeup(0.01, loop); 
} 
////////////////////////////////////////
// Setup Stuff: Runs first at startup //
////////////////////////////////////////
hardware.pin1.configure(PWM_OUT, 0.0005, 0.0);   // Configure 
Pin 1 as PWM output, 5ms period, 0% high (off)
hardware.pin5.configure(ANALOG_IN); // Configure pin 5 as anal
og input
hardware.pin9.configure(DIGITAL_IN_PULLUP, pin9changed); // Co
nfigure pin 9 as digital input (with pull­up enabled). On chan
ge it'll call function pin9changed().
imp.configure("LED Trigger Wiper", [], []);
loop(); // Call loop, and let the program go!
The code creates an adjustable-brightness LED controller. The brightness
of the LED is adjusted by turning the potentiometer. Pressing the button will
turn the LED on and off.
Explaining the Code
The skeleton of this code acts a lot like that of Hello, blink. The function
definitions are up top, the setup stuff runs at the bottom, and loop() is
called at the beginning. loop() continually calls itself, using the
imp.wakeup(0.01, loop) function call, every 10 ms.
The loop() function again relies on an ledState variable. If ledState is
1, we read the potentiometer voltage, and adjust the brightness of our LED
accordingly.
The ledState variable is flip-flopped in the pin9changed() function. This
is like an interrupt. It’s called whenever the state of pin 9 changes – if it
goes from high to low, or low to high. When setting up pin 9 as a digital
input, we added this function as the one to be called when the state change
occurred.
Check out the comments in the code for a more in-depth overview of each
function call. Or, for more information, check out Electric Imp’s API
reference.
Enough hardware stuff! The next two examples will make use of the imp’s
greatest feature…it’s web connectivity.
Example 2: Web Control (Request)
Some of the most fun you can have with the imp is connecting it to the
Internet, and interfacing it with web pages. In this example, we’ll use a
simple HTML/Javascript web page to control some LEDs connected to the
imp.
This time, we’ll not only be writing code for the imp, but the agent as well.
This example code will show how to pass data from the imp to the agent,
and how to write a simple web page to interact with the agent half of the
code.
Page 21 of 40



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40


датащи скачать

Go To PDF Page


ссылки URL



Вашему бизинису помогли Аллдатащит?  [ DONATE ] 

Что такое Аллдатащит   |   реклама   |   контакт   |   Конфиденциальность   |   Ссылка на техническое описание    |   обмен ссыками   |   поиск по производителю
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com