This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <avr/interrupt.h> | |
int pulseLen = 1; | |
int pulseLenStep = 1; | |
void setup() { | |
pinMode(4,OUTPUT); | |
TIMSK1 |= 1; | |
TCCR1B |= (1<<WGM12); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ------------------------------------------------ | |
Распиновка I2C экспандера: | |
I2C смотрит налево. | |
1 - GND | |
2 - VCC | |
3 - | |
4 - | |
5 - датчик X - бит Y | |
6 - датчик X - бит Y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
Serial.begin(115200); | |
pinMode(16,INPUT); | |
pinMode(2,INPUT); | |
pinMode(10,INPUT); | |
} | |
void loop() { | |
Serial.print("1: "); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int REDpin = 9; | |
int GREENpin = 10; | |
int BLUEpin = 11; | |
void setup() { | |
Serial.begin(9600); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import requests | |
import json | |
# IP адрес сервера | |
tws_IP = '34.24' | |
# ключ | |
app_key = '3dedb7c4-6ff9-' | |
# название вещи | |
thing_name = 'testThing' | |
# свойство, значение которого меняем PUT запросом |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <HTU21D.h> | |
//#include <HTU21D.h> | |
#include <Wire.h> | |
/**************************************************************************** | |
Arduino to Thingworx Ethernet Web Client using Ethernet Shield | |
This sketch reads sensor values and sends the values to a Thing on ThingWorx. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// пины для цветных каналов | |
#define R_PIN 11 | |
#define G_PIN 10 | |
#define B_PIN 9 | |
// пины для общих концов светодиодов | |
#define PIN_1 2 | |
#define PIN_2 3 | |
#define PIN_3 4 | |
#define PIN_4 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define LEDS_PINS 6 | |
const boolean LEDsJingleBells[][21] = { | |
{0,0,0,1,0,1,0,0,0,1,1,1,0,1,0,1,0,1,0,1,0}, // график включений каждого светодиода в такт нотам | |
{0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,0}, | |
{0,0,0,1,0,1,0,0,0,1,1,1,0,1,0,1,0,1,0,1,0}, | |
{0,0,0,1,0,1,0,0,0,1,1,1,0,1,0,1,0,1,0,1,0}, | |
{0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0}, | |
{0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0} | |
}; | |
//Нота 0 1 2 3 4 5 6 7 8 9 10 11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> | |
#define BUTTON_PIN 8 | |
#define LED_PIN 7 | |
#define SERVO_PIN 2 | |
// объект для сервы | |
Servo mservo; | |
// позиция, на которую должен повернуться движок | |
uint8_t pos = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// допустим, функций три. Заведем макрос с количеством функций, | |
// чтобы потом при смене количества было меньше ошибок | |
#define FUNC_NUM 3 | |
// Напишем прототипы функций. | |
// Определения функций напишем потом внизу, | |
// чтобы они здесь не мозолили глаза | |
void f1(void); | |
void f2(void); | |
void f3(void); |