عليكم السلام أخي الكريم
والمقصود هو

|
بارك الله فيك اخي اكري و زادك علما و فهما
لاكن هذا عبارة عن سويتش لاختيار مود rs-232 عند تشغيل يعمل الميكرو كنترولر Boot Waite سواء تختار مود rs-232 او تشغيل عادي ب سويتش اخر و لتوضيح اكثر شاهد هذا الفيديو الخاص بي
هذا جزء من البرنامج
* Code to controll an 8x8x8 ledcube using avr
*
http://www.instructables.com/id/Led-Cube-8x8x8/
* See lisence.txt for lisence.
*/
#include "main.h"
#include "effect.h"
#include "launch_effect.h"
#include "draw.h"
// Main loop
// the AVR enters this function at boot time
int main (void)
{
// This function initiates IO ports, timers, interrupts and
// serial communications
ioinit();
// This variable specifies which layer is currently being drawn by the
// cube interrupt routine. We assign a value to it to make sure it's not >7.
current_layer = 1;
int i;
// Boot wait
// This function serves 3 purposes
// 1) We delay starting up any interrupts, as drawing the cube causes a lot
// noise that can confuse the ISP programmer.
// 2) Listen for button press. One button means go into rs232 mode,
// The other means go into autonomous mode and start doing stuff.
// 3) Random seed. The bootwait function counts forever from 0 to 255.
// Whenever you press the button, this counter stops, and the number it
// stopped at is used as a random seed. This ensures true randomness at
// every boot. Without this (or some similar process) the cube would
// produce the same "random" sequence every time
i = bootwait();
// Enable interrupts
// This starts the routine that draws the cube content
sei();
// Result for bootwait() is 2:
// Go to rs232 mode. this function loops forever.
if (i == 2)
{
rs232();
}
// Result of bootwait() is something other than 2:
// Do awesome effects. Loop forever.
while (1)
{
// Show the effects in a predefined order
for (i=0; i<EFFECTS_TOTAL; i++)
launch_effect(i);
// Show the effects in a random order.
// Comment the two lines above and uncomment this
// if you want the effects in a random order.
//launch_effect(rand()%EFFECTS_TOTAL);
}
}