Ср янв 09, 2019 09:47:57
Ср янв 09, 2019 11:48:56
Ср янв 09, 2019 11:55:47
Ср янв 09, 2019 12:01:28
byte ledPin=13;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(ledPin, HIGH); // sets the LED on
delay(12500); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(500); // waits for a second
}
Ср янв 09, 2019 12:04:57
Ср янв 09, 2019 13:02:00
Ср янв 09, 2019 13:22:47
Ср янв 09, 2019 13:42:38
Ср янв 09, 2019 13:49:45
Ср янв 09, 2019 13:57:48
Ср янв 09, 2019 18:39:55
Ср янв 09, 2019 18:52:54
Чт янв 10, 2019 08:57:05
Чт янв 10, 2019 10:08:48
Чт янв 10, 2019 15:14:34
Чт янв 10, 2019 19:05:20
Пт янв 11, 2019 09:11:28
Сб янв 12, 2019 16:29:45
Вообще-то можно и добавить.BOB51 писал(а):Attiny 2313 в перечень ардуин не включена.
Если уж очень хочется с этим МК работать - то под "чистым Си"/ассемблером (там памяти программ совсем уж мало).
#include <avr/io.h>
#define SPEED 3000 //Скорость бегущих огней
void pause (unsigned int a) //Задержка
{ unsigned int i;
for (i=a;i>0;i--);
}
int main(void)
{
unsigned char i;
DDRB=0xff; //Инициализация портов ввода/вывода
DDRD=0x7f;
PORTB=0xff;
PORTD=0x7f;
while (1) //Вечный цикл
{
for (i=0;i<8;i++) //По одному зажигаем светодиоды на PORTB
{
PORTB=~_BV(i);
pause(SPEED);
}
PORTB=0xff;
for (i=0;i<7;i++) //По одному зажигаем светодиоды на PORTD
{
PORTD=~_BV(i);
pause(SPEED);
}
PORTD=0x7f;
}
}
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino model, check
the Technical Specs of your board at https://www.arduino.cc/en/Main/Products
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Сб янв 12, 2019 20:47:50
Чт янв 31, 2019 19:29:22