let mut x = 24; // mut x: i32
while x>0 {
x = x - 1;
block!(timer.wait()).unwrap();
led.set_high().unwrap();
led.set_low().unwrap();
led.set_low().unwrap();
//led.set_low().unwrap();
block!(timer.wait()).unwrap();
}
x=24;
while x>0 {
x = x - 1;
block!(timer.wait()).unwrap();
led.set_high().unwrap();
block!(timer.wait()).unwrap();
led.set_low().unwrap();
}
x=24;
while x>0 {
x = x - 1;
block!(timer.wait()).unwrap();
led.set_high().unwrap();
led.set_low().unwrap();
led.set_low().unwrap();
//led.set_low().unwrap();
block!(timer.wait()).unwrap();
}
x=24;
while x>0 {
x = x - 1;
block!(timer.wait()).unwrap();
led.set_high().unwrap();
block!(timer.wait()).unwrap();
led.set_low().unwrap();
}
block!(timer.wait()).unwrap();
led.set_high().unwrap();
led.set_low().unwrap();
led.set_low().unwrap();
//led.set_low().unwrap();
block!(timer.wait()).unwrap();
это единицаblock!(timer.wait()).unwrap();
led.set_high().unwrap();
block!(timer.wait()).unwrap();
led.set_low().unwrap();
это нольmacro_rules! low_high_wait {
(low) => {
led.set_low().unwrap();
};
(high) => {
led.set_high().unwrap();
};
(wait) => {
block!(timer.wait()).unwrap();
};
(low, $($rest:tt),+) => {
low_high_wait!(low);
low_high_wait!($($rest),+);
};
(high, $($rest:tt),+) => {
low_high_wait!(high);
low_high_wait!($($rest),+);
};
(wait, $($rest:tt),+) => {
low_high_wait!(wait);
low_high_wait!($($rest),+);
};
}
for _ in 0..24 {
low_high_wait!(wait, high, low, low, wait);
}
for _ in 0..24 {
low_high_wait!(wait, high, wait, low);
}
for _ in 0..24 {
low_high_wait!(wait, high, low, low, wait);
}
for _ in 0..24 {
low_high_wait!(wait, high, wait, low);
}