نوشته شده در دیدگاه‌تان را بنویسید

راه اندازی ماژول آلتراسونیک با آردینو

آلتراسونیک

اساس کار ماژول های آلتراسونیک:

این ماژول امواج صوتی با فرکانس بالا ایجاد می‌کنند و موج بازتاب شده را دریافت و تحلیل می‌کنند. این ماژول با محاسبهٔ زمان بین فرستادن سیگنال و گرفتن بازتاب، فاصلهٔ جسم را محاسبه می‌کنند.

تفاوت ماژول آلتراسونیک SRF05 و SR04:

این دو ماژول در بسیاری از ویژگی ها مشابه هم هستند ماژول SRF05 در واقع تکمیل شده و اصلاح شده ماژول SR04 می باشد. پایه ها و نوع طراحی این ماژول ها به طوری است که می توان با یک برنامه از هر دو ماژول استفاده کرد در زیر تصویر هر دو ماژول را می بینید.

hy-srf05-top

hy-srf05-%d8%a7%d9%84%da%a9%d8%aa%d8%b1%d9%88%d9%84%d8%a8

همان طور که در تصویر هم مشخص است پایه ی out به ماژول SRF05 اضافه شده که این پایه در ماژول دیگر موجود نیست از این پایه برای تعیین عملکرد ماژول اشتفاده می شود. در ادامه بیشتر در مورد این پایه بحث می کنیم.

ادامهٔ «راه اندازی ماژول آلتراسونیک با آردینو»

نوشته شده در دیدگاه‌تان را بنویسید

کلیه مثالهای موجود در نرم افزار آردینو و توضیح مختصر برنامه و کارایی آنها

 

 

 

Core Functions

Simple programs that demonstrate basic Arduino commands. These are included with the Arduino environment; to open them, click the Open button on the toolbar and look in the examples folder.

1.Basics

  • BareMinimum: The bare minimum of code needed to start an Arduino sketch.
  • Blink: Turn an LED on and off.
  • DigitalReadSerial: Read a switch, print the state out to the Arduino Serial Monitor.
  • AnalogReadSerial: Read a potentiometer, print its state out to the Arduino Serial Monitor.
  • Fade: Demonstrates the use of analog output to fade an LED.
  • ReadAnalogVoltage : Reads an analog input and prints the voltage to the serial monitor

2.Digital

  • Blink Without Delay: blinking an LED without using the delay() function.
  • Button: use a pushbutton to control an LED.
  • Debounce: read a pushbutton, filtering noise.
  • Button State Change: counting the number of button pushes.
  • Input Pullup Serial: Demonstrates the use of INPUT_PULLUP with pinMode().
  • Tone: play a melody with a Piezo speaker.
  • Pitch follower: play a pitch on a piezo speaker depending on an analog input.
  • Simple Keyboard: a three-key musical keyboard using force sensors and a piezo speaker.
  • Tone4: play tones on multiple speakers sequentially using the tone() command.

3.Analog

  • AnalogInOutSerial: Read an analog input pin, map the result, and then use that data to dim or brighten an LED.
  • Analog Input: Use a potentiometer to control the blinking of an LED.
  • AnalogWriteMega: Fade 12 LEDs on and off, one by one, using an Arduino Mega board.
  • Calibration: Define a maximum and minimum for expected analog sensor values.
  • Fading: Use an analog output (PWM pin) to fade an LED.
  • Smoothing: Smooth multiple readings of an analog input.

4.Communication

These examples include code that allows the Arduino to talk to Processing sketches running on the computer. For more information or to download Processing, see processing.org. There are also Max/MSP patches that can communicate with each Arduino sketch as well. For more on Max/MSP see Cycling 74. For Pd patches that can communicate with these sketches, see Scott Fitzgerald’s examples.

  • ReadASCIIString: Parse a comma-separated string of ints to fade an LED.
  • ASCII Table: Demonstrates Arduino’s advanced serial output functions.
  • Dimmer: Move the mouse to change the brightness of an LED.
  • Graph: Send data to the computer and graph it in Processing.
  • Physical Pixel: Turn a LED on and off by sending data to your Arduino from Processing or Max/MSP.
  • Virtual Color Mixer: Send multiple variables from Arduino to your computer and read them in Processing or Max/MSP.
  • Serial Call Response: Send multiple variables using a call-and-response (handshaking) method.
  • Serial Call Response ASCII: Send multiple variables using a call-and-response (handshaking) method, and ASCII-encode the values before sending.
  • SerialEvent: Demonstrates the use of SerialEvent().
  • Serial input (Switch (case) Statement): How to take different actions based on characters received by the serial port.
  • MIDI: Send MIDI note messages serially.
  • MultiSerialMega: Use two of the serial ports available on the Arduino Mega.

5.Control Structures

  • If Statement (Conditional): How to use an if statement to change output conditions based on changing input conditions.
  • For Loop: Controlling multiple LEDs with a for loop and.
  • Array: A variation on the For Loop example that demonstrates how to use an array.
  • While Loop: How to use a while loop to calibrate a sensor while a button is being read.
  • Switch Case: How to choose between a discrete number of values. Equivalent to multiple If statements. This example shows how to divide a sensor’s range into a set of four bands and to take four different actions depending on which band the result is in.
  • Switch Case 2: A second switch-case example, showing how to take different actions based in characters received in the serial port.

6.Sensors

  • ADXL3xx: Read an ADXL3xx accelerometer.
  • Knock: Detect knocks with a piezo element.
  • Memsic2125 : Two-axis acceleromoter.
  • Ping: Detecting objects with an ultrasonic range finder.

7.Display

Examples of basic display control

8.Strings

9.USB (Leonardo, Micro, and Due specific examples)

The Keyboard and Mouse examples are unique to the Leonardo, Micro and Due. They demonstrate the use of libraries that are unique to the board.

Keyboard

  • KeyboardMessage: Sends a text string when a button is pressed.
  • KeyboardLogout : Logs out the current user with key commands.
  • KeyboardSerial: Reads a byte from the serial port, and sends back a keystroke.
  • KeyboardReprogram : Opens a new window in the Arduino IDE and reprograms the Leonardo with a simple blink program.

Mouse

نوشته شده در دیدگاه‌تان را بنویسید

انواع محصولات آردینو

 

 

 

BOARDS (Compare Specs)

SHIELDS

KITS

Arduino Uno

Arduino Leonardo

Arduino GSM Shield

The Arduino Starter Kit

Arduino Due

Arduino Yún

Arduino Ethernet Shield

Arduino Materia 101

Arduino Tre

Arduino Zero

Arduino WiFi Shield

ACCESSORIES

Arduino Micro

Arduino Esplora

Arduino Wireless SD Shield

TFT LCD screen

Arduino Mega ADK

Arduino Ethernet

Arduino USB Host Shield

USB/Serial Light Adapter

Arduino Mega 2560

Arduino Robot

Arduino Motor Shield

Arduino ISP

Arduino Mini

Arduino Nano

Arduino Wireless Proto Shield

Mini USB/Serial Adapter

LilyPad Arduino Simple

LilyPad Arduino SimpleSnap

Arduino Proto Shield

LilyPad Arduino

LilyPad Arduino USB

Arduino Pro Mini

Arduino Fio

Arduino Pro

نوشته شده در دیدگاه‌تان را بنویسید

آموزش جامع برنامه ریزی و راه اندازی بردهای میکروکنترلری آردینو

 

 

موضوع : آموزش جامع برنامه ریزی و راه اندازی بردهای میکروکنترلری آردینو

گردآوری : ابراهیم شهنازی اریسمانی

استاد : آقای دکتر محلوجی

رشته : کارشناسی ارشد مهندسی مکاترونیک

دانشگاه : آزاد اسلامی واحد کاشان

نوع فایل: pdf

زبان : فارسی

تعداد صفحات: 81صفحه

حجم : 1184 KB

دانلود

نوشته شده در 2 دیدگاه

آموزش ساخت مدار چشمک زن با برد آردینو به همراه برنامه

Introduction

OK you’ve gotten your Arduino set up and also figured out how to use the software to send sketches to the board. Next step is to start writing your own sketches. We’ll start off easy by just modifying something that already works.

To start we will venture deep into the Blink sketch, looking at each line and trying to understand what its doing.

Then we will start hacking the sketch!

Blinkie

Start up the Arduino software and open the Blink example sketch, as you did in Lesson 1.

The sketch itself is in the text input area of the Arduino software. Sketches are written in text, just like a document. When you select Compile/Verify from the menu, the Arduino software looks over the document and translates it to Arduino-machine-language – which is not human-readable but is easy for the Arduino to understand.

Sketches themselves are written in C, which is a programming language that is very popular and powerful. It takes a bit of getting used to but we will go through these examples slowly.

 /*  * Blink  *  * The basic Arduino example.  Turns on an LED on for one second,  * then off for one second, and so on...  We use pin 13 because,  * depending on your Arduino board, it has either a built-in LED  * or a built-in resistor so that you need only an LED.  *  * http://www.arduino.cc/en/Tutorial/Blink  */   int ledPin = 13;                // LED connected to digital pin 13  void setup()                    // run once, when the sketch starts {   pinMode(ledPin, OUTPUT);      // sets the digital pin as output }   void loop()                     // run over and over again {   digitalWrite(ledPin, HIGH);   // sets the LED on   delay(1000);                  // waits for a second   digitalWrite(ledPin, LOW);    // sets the LED off   delay(1000);                  // waits for a second }
Comments

Lets examine this sketch in detail starting with the first section:

/*  * Blink  *  * The basic Arduino example.  Turns on an LED on for one second,  * then off for one second, and so on...  We use pin 13 because,  * depending on your Arduino board, it has either a built-in LED  * or a built-in resistor so that you need only an LED.  *  * http://www.arduino.cc/en/Tutorial/Blink  */

This is a comment, it is text that is not used by the Arduino, its only there to help humans like us understand whats going on. You can tell if something is a comment because there is a /* at the beginning and a */ at the end. Anything between the /* and */ is ignored by the Arduino. In this example the person who wrote the comment decided to make it look pretty and add *’s down the side but this isn’t necessary.
Comments are very useful and I strongly encourage every sketch you make have a comment in the beginning with information like who wrote it, when you wrote it and what its supposed to do.

Variables

Lets look at the next line:

int ledPin = 13;                // LED connected to digital pin 13

This is the first line of actual instruction code. It is also extremely unlike English (or any other human language). The first part we can easily understand is the part to the right, which is also a comment. Turns out if you want to make a small comment, you can use // as well as /* */. // is often used for short, one line comments.

The rest of the line, the stuff before the //, is what is called a statement, which is basically like a computerized sentence. Much like human sentances end with a . (period), all computer sentences end with a ; (semicolon)

OK all we have left is the statement itself, which turns out to be a sentence telling the computer that we would like it to create a box named ledPin and to put the number 13 in that box. If you remember your math, you may recall that the box is also known as variable.

box-type
box-name
=
stuff-to-put-in-box
int
ledPin
=
13

The first part of this sentence is int, which is short for integer which is a fancy way of saying whole number
The second part of this sentence is ledPin which is the name of the box
The third part is an =, which basically says that the variable (box) named ledPin should start out equaling whatever is after the =
The fourth part is 13, a whole number (integer) which is assigned to ledPin

Procedures

Lets move on to the next section

void setup()                    // run once, when the sketch starts {   pinMode(ledPin, OUTPUT);      // sets the digital pin as output }

OK we’ve got two comments, each starting with //. We understand comments already so lets skip that.
We also see in the middle there is a statement, we know its a statement because it ends with a ; (semicolon) however there’s a whole bunch more stuff before and after it.
This bunch of code is an example of a procedure, a procedure is a collection of statements, its used to group statements together so that we can refer to them all with one name. Its just like a procedure that we use to perform a task step by step.

returned value
procedure name
(input values)
{ statements }
void
setup
()
{ pinMode(ledPin, OUTPUT); }

To better understand procedures, lets use an analogy to the kinds of procedures we’re used to

clean cat wash the cat(dirty cat)                    // a procedure for washing the cat { 	turn on the shower. 	find the cat. 	grab the cat. 	put cat under shower. 	wait 3 minutes.                                     // wait for cat to get clean. 	release cat. }

This is a procedure for washing the cat. The name of the procedure is wash the cat, it uses a dirty cat as the input and returns a clean cat upon success. There are two brackets, an open bracket { and a closed bracket }, thats are used to indicate the beginning and end of the procedure. Inside the procedure are a bunch of statements, indicating the correct procedure for washing a cat. If you perform all of the statements then you should be able to turn a dirty cat into a clean cat.

Looking again at the procedure, we see that it is named setup and it has no input values and it returns void. Now you’re probably asking yourself “what is void?” Well thats a computer-scientist way of saying nothing. That is, this procedure doesnt return anything. (That doesnt mean it doesn’t do anything, just that it doesn’t have a tangible number or whatever, to show when its complete)

void setup()                    // run once, when the sketch starts

There is one statment in this procedure,

pinMode(ledPin, OUTPUT);      // sets the digital pin as output

We’ll return to this statement in detail later, suffice to say it is a way of telling the Arduino what we would like to do with one of the physical pins on the main processor chip.

Procedure calls

We’re onto the next bunch of text.

void loop()                     // run over and over again {   digitalWrite(ledPin, HIGH);   // sets the LED on   delay(1000);                  // waits for a second   digitalWrite(ledPin, LOW);    // sets the LED off   delay(1000);                  // waits for a second }

Using our now well-honed technique we recognize that the text to the right is all comments. We also recognize another procedure, this one called loop which also has no inputs or output. This procedure has multiple statements, one after the other.

We’re going to skip the first statement for now and go straight to statement #2.

The second and fourth statements are the same, and have something to do with a delay. This statement is very similar to the “wait 3 minutes.” command in our cat-washing procedure. This statement says “Dear Arduino. Stop what you’re doing for a short amount of time. Thanks!”
To do this, the statement performs a procedure call. (We will use the phrasing calls a procedure). Basically, we want the Arduino to take a break but don’t quite know how to do it, lucky for us, someone else wrote a procedure called delay which we can call upon to do the work for us. Kind of like if we need to do our taxes and we dont know how, we call upon an accountant to do it for us, giving them the paperwork input and getting tax return as the result.

procedure name
(input values)
;
delay
(1000)
;

This means that somewhere out there, there’s a procedure something like this:

void delay(number of milliseconds)   {   "Dear Arduino. Stop what you're doing for (number of milliseconds) amount of time. Thanks!"  }

(Of course, this example is not proper code)Turns out this delay procedure works pretty well, and all we have to do is tell it how many milliseconds (1/1000th of a second) to wait and it will do the job for us.

Returning to the first statment, we see that it is also a procedure call. This time for some procedure called digitalWrite. We’ll also skip this one in detail for a bit, except to explain that its turning a pin on the Arduino chip on and off, and that pin is powering the LED so in essence its turning the LED on and off.

Special Procedures – Setup() and Loop()

I do want to mention quickly here that the two procedures we’ve mentioned so far are extra-special in that when the Arduino first wakes up after being reset, it always does whats in the setup procedure first. Then it does whatever is in the loop procedure over and over and over…forever! Or at least until you turn it off.

Modifying the example
Now that we’ve analyzed the entire program it’s time to make some changes. In your Arduino software, change the number in the delay procedure calls to 500 (from 1000) as shown

void loop()                     // run over and over again {   digitalWrite(ledPin, HIGH);   // sets the LED on   delay(500);                  // waits for a second   digitalWrite(ledPin, LOW);    // sets the LED off   delay(500);                  // waits for a second }

If you try to save the sketch, you’ll get the warning that it’s read-only.

Not a big deal, you can save it under a new name, such as MyBlink

Compile/Verify the sketch and Upload it, using your Lesson 1 techniques.

Once the Arduino has been updated with the new sketch you should see a faster-blinking light than before

If the LED is not blinking faster, check:

  • Did you make the changes to the delay procedure call to make it 500?
  • Did the compile/verify complete successfully? (should look like the screenshot above)
  • Did the upload complete successfully? (should look like the screenshot above)

 

Exercises

Now it time for you to make modifications to the sketch and experiment with different delay values

Exercise 1.
Modify the code so that the light is on for 100 msec and off for 900 msec

Exercise 2.
Modify the code so that the light is on for 50 msec and off for 50 msec. What happens?

Highlight the text below to see the answer
Intense strobe action!

Exercise 3.
Modify the code so that the light is on for 10 ms and off for 10 ms. What happens?

Highlight the text below to see the answer
The light is no longer blinking

Now pick up the Arduino and gently wave it back and forth, in a dark room. What happens?
Highlight the text below to see the answer
The LED creates a dashed trail of light in the air. z

What do you think is happening here?
Highlight the text below to see the answer
The LED is blinking, but its blinking so fast that our eyes can’t pick it up, so it looks like a blur. When the Arduino is waved in the air, we see streaks of light from the blinks.

Wrap up

Congrats, you have finished the second lesson!

In this lesson you examined the Blink sketch in detail, and learned a bit of the language used to talk to the Arduino. You also learned how to modify a sketch, and practiced uploading sketches to the Arduino some more.

نوشته شده در دیدگاه‌تان را بنویسید

دانلود آموزش ساخت کنترل بازوی رباتیک 5 درجه آزادی با جوی استیک ( آردینو )

کنترل بازوی رباتیک درجه5 آزادی با جوی استیک

طراحی وساخت : آقای مهندس ابراهیم شهنازی اریسمانی
استاد راهنما : آقای دکتر خوش بیانی
دانشگاه : آزاد واحد کاشان

زبان : فارسی

نوع فایل : PDF
2.51 مگابایت

دریافت