ازاي تنور لمبة و تطفيها بالماتلاب و الاردوينو

Start WithMatlab And Arduino

                                                                                                                     [B][COLOR=#3366ff][COLOR=#000080][COLOR=#2770b0]ازاي تنور لمبة و تطفيها بالماتلاب و الاردوينو [/color]

[/color][/color][/b]

Hardware setup

وصل زي الصورة دي بالظبط

Connect an LED to digital pin 11 on the Arduino hardware through a 1KOhm resistor.

Create an arduino object

افتح الماتلاب و اكتب الكلام باللون الازرق

[B]

[COLOR=#000080]a = arduino();[/color]

[/b]

a ده معناه ان اننا موصل اردوينو واسمه

If you have more than one Arduino board connected, specify the port and board type.

a = arduino('com23', 'uno');

Turn LED on and off

Write value 1 or true to digital pin 13 turns on the built-in LED and write a value of 0 or false turns it off. Execute the following command at the MATLAB prompt to turn the LED off and on.

هنا هنبتدي نشغل و نطفي اللمبة

[B]

[B] writeDigitalPin(a, ‘D13’, 0);[/b]

[/b]

pin3عشان نطفي اللمبة هنبعت0علي





 [B][B] pause(2);[/b][/b]

 [B] writeDigitalPin(a, ‘D13’, 1);       [/b]


pin3عشان نشغل اللمبة هنبعت 1علي

Configure the LED to blink at a period of 1 second.

هنا هنخلي اللمبة تنور نصف ثانية و تطفي نصف ثانية لمدة 10 ثواني

[B][COLOR=#000080]  for i = 1:10 [/color][/b]

 [B][COLOR=#000080]          writeDigitalPin(a, ‘D13’, 0); pause(0.5); [/color][/b]

 [B][COLOR=#000080]           writeDigitalPin(a, ‘D13’, 1); [/color][/b]

 [B][COLOR=#000080]            pause(0.5);[/color][/b]


end

للامانة هذا الموضوع تم اقتباسه من www.maklab.org