This commit is contained in:
RedGuy 2023-06-20 19:38:41 +03:00
parent c49adffd1c
commit 781d3cd6d8
4 changed files with 81 additions and 0 deletions

32
sketch_aug18b.ino Normal file
View File

@ -0,0 +1,32 @@
#include <NewTone.h>
#include "IRremote.h"
IRrecv irrecv(2); // указываем вывод, к которому подключен приемник
decode_results results;
int note;
void setup() {
Serial.begin(9600); // выставляем скорость COM порта
irrecv.enableIRIn(); // запускаем прием
}
void loop() {
if ( irrecv.decode( &results )) { // если данные пришли
Serial.println( results.value ); // печатаем данные
if(results.value == 16769565) {
note=note+50;
NewTone(6,note,500);
}
if(results.value == 16753245) {
note=note-50;
NewTone(6,note,500);
}
if(results.value == 16736925) {
NewTone(6,note,1000);
}
irrecv.resume(); // принимаем следующую команду
}
}

10
sketch_sep06a.ino Normal file
View File

@ -0,0 +1,10 @@
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(analogRead(0));
}

19
sketch_sep09a.ino Normal file
View File

@ -0,0 +1,19 @@
#include <Stepper.h>
const int stepsPerRevolution = 1000; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
int stepCount = 0; // number of steps the motor has taken
void setup() {
// nothing to do inside the setup
}
void loop() {
myStepper.step(analogRead(A0)*10);
}

20
sketch_sep15a.ino Normal file
View File

@ -0,0 +1,20 @@
#include <boarddefs.h>
#include <IRremote.h>
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>
int melody;
void setup() {
// put your setup code here, to run once:
pinMode(2,INPUT);//Пульт
pinMode(12,OUTPUT);//Голова
pinMode(10,OUTPUT);//Туловище
pinMode(11,OUTPUT);//Ноги
pinMode(9,OUTPUT);//бок
}
void loop() {
// put your main code here, to run repeatedly:
}