doc_id stringlengths 36 36 | metadata dict | input stringlengths 28 4.3k | output stringlengths 11 5.45k |
|---|---|---|---|
8f02e916-58ea-4f95-96fe-94a794b9a792 | {
"language": "Arduino"
} | ```arduino
/*
Basic MQTT example with Authentication
- connects to an MQTT server, providing username
and password
- publishes "hello world" to the topic "outTopic"
- subscribes to the topic "inTopic"
*/
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
const char *ssid = "xxxxxxxx"; // cannot be longe... | ```arduino
/*
Basic MQTT example with Authentication
- connects to an MQTT server, providing username
and password
- publishes "hello world" to the topic "outTopic"
- subscribes to the topic "inTopic"
*/
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
const char *ssid = "xxxxxxxx"; // cannot be longe... |
aa89a5c6-0d3c-4fbc-8a82-ded4eef524bc | {
"language": "Arduino"
} | ```arduino
# 2 "TestSystemInfo.ino"
#include <Arduino.h>
#include <Arduino_FreeRTOS.h>
#include <StandardCplusplus.h>
#include <RabirdToolkit.h>
#include <RTest.h>
#include <RRawPointer.h>
#include <RSharedPointer.h>
#include <RFormatter.h>
RTEST(TestSystemInfo)
{
RFormatter formatter(manager()->printer());
for... | ```arduino
# 2 "TestSystemInfo.ino"
#include <Arduino.h>
#include <Arduino_FreeRTOS.h>
#include <StandardCplusplus.h>
#include <RabirdToolkit.h>
#include <RTest.h>
RTEST(TestSystemInfo)
{
RASSERT_MORE(sizeof(int), 0);
RASSERT_MORE(sizeof(uintptr_t), 0);
RASSERT_MORE(sizeof(rsize), 0);
RASSERT_MORE(sizeof(rnu... |
9c02a082-5c81-4e89-ac27-1dc5413eaee2 | {
"language": "Arduino"
} | ```arduino
#include <Arduboy.h>
#include <ArdVoice.h>
#include "voices.h"
Arduboy arduboy;
ArdVoice ardvoice;
void setup() {
arduboy.begin();
arduboy.setFrameRate(30);
ardvoice.playVoice(merry_q6);
}
void loop() {
if (!(arduboy.nextFrame()))
return;
if (arduboy.pressed(B_BUTTON)){
ardvoice.playVoice(merry... | ```arduino
#include <Arduboy2.h>
#include <ArdVoice.h>
#include "voices.h"
Arduboy2 arduboy;
ArdVoice ardvoice;
void setup() {
arduboy.begin();
arduboy.setFrameRate(30);
ardvoice.playVoice(merry_q6);
}
void loop() {
if (!(arduboy.nextFrame()))
return;
if (arduboy.pressed(B_BUTTON)){
ardvoice.playVoice(mer... |
d8ffb084-6054-42e4-9e52-e009b5d08071 | {
"language": "Arduino"
} | ```arduino
int vinpin = A0;
int voutpin = A1;
int gndpin = A2;
int zpin = A3;
int ypin = A4;
int xpin = A5;
void setup() {
Serial.begin(9600);
pinMode(vinpin, OUTPUT); digitalWrite(vinpin, HIGH);
pinMode(gndpin, OUTPUT); digitalWrite(gndpin, LOW);
pinMode(voutpin, INPUT);
pinMode(xpin, INPUT);
pinMode(ypin... | ```arduino
int zpin = A3;
int ypin = A4;
int xpin = A5;
// Uncomment the following lines if you're using an ADXL335 on an
// Adafruit breakout board (https://www.adafruit.com/products/163)
// and want to plug it directly into (and power it from) the analog
// input pins of your Arduino board.
//int vinpin = A0;
//int ... |
0da8e2d0-5e84-4d29-8cfa-31545cfe3cf3 | {
"language": "Arduino"
} | ```arduino
#include "display.h"
#include "sensor.h"
#include <LiquidCrystal.h> // Arduino LCD library
#include <Arduino.h> // enables use of byte pics
void setup() {
LCD::setup();
Sensor::setup();
}
void loop() {
int temp = Sensor::readTemp();
LCD::displayTemp(temp);
delay(5000);
LCD::clearScreen();
}
`... | ```arduino
#include "display.h"
#include "sensor.h"
#include <LiquidCrystal.h> // Arduino LCD library
#include <Arduino.h> // enables use of byte pics
void setup() {
Display::setup();
Sensor::setup();
}
void loop() {
int temp = Sensor::readTemp();
int hum = Sensor::readHum();
Display::displayTemp(temp);
... |
3c8c0a8e-b964-4cdc-8af8-3dd48c1197ac | {
"language": "Arduino"
} | ```arduino
int motorPin = 9;
int switchPin = 7;
int motorStep = 0;
int maxStep = 200;
int minimumStepDelay = 2;
String motorState = String("off");
void makeStep() {
digitalWrite(motorPin, HIGH);
digitalWrite(motorPin, LOW);
motorStep += 1;
if (motorStep > maxStep) {
motorStep = 0;
}
}
void resetMotor(... | ```arduino
int enablePin = 4;
int MS1Pin = 5;
int MS2Pin = 6;
int MS3Pin = 7;
int resetPin = 9;
int sleepPin = 10;
int motorPin = 11;
int directionPin = 12;
int switchPin = 13;
// Stepping: Full, half, quarter, eigth, sixteenth
int[] stepping = {
B000,
B100,
B010,
B110,
B111
}
int motorStep = 0;
int maxSt... |
3dcf50a0-9fec-415a-bccb-b42be73bbb22 | {
"language": "Arduino"
} | ```arduino
#define DEBUG
#include "TheThingsUno.h"
const byte devAddr[4] = { 0x02, 0xDE, 0xAE, 0x00 };
const byte appSKey[16] = { 0x0D, 0x0E, 0x0A, 0x0D, 0x0B, 0x0E, 0x0E, 0x0F, 0x0C, 0x0A, 0x0F, 0x0E, 0x0B, 0x0A, 0x0B, 0x0E };
const byte nwkSKey[16] = { 0x0D, 0x0E, 0x0A, 0x0D, 0x0B, 0x0E, 0x0E, 0x0F, 0x0C, 0x0A, 0x0... | ```arduino
#define DEBUG
#include "TheThingsUno.h"
const byte devAddr[4] = { /* copy DevAddr here */ };
const byte appSKey[16] = { /* copy AppSKey here */ };
const byte nwkSKey[16] = { /* copy NwkSKey here */ };
#define debugSerial Serial
#define loraSerial Serial1
// These are the input pins of your sensors
#defin... |
1624b262-b90c-410f-93eb-5572ebe2af96 | {
"language": "Arduino"
} | ```arduino
/*
TestSuite sketch
Use this sketch when running the Liberty Arduino Feature test suite.
*/
#include <EEPROM.h>
#include <Liberty.h>
Liberty liberty("TestNode");
boolean ns = false;
int nc = 0;
unsigned long ln;
byte bs[20];
void setup() {
liberty.sram(sramBytes, 20);
liberty.invocable("foo"... | ```arduino
/*
TestSuite sketch
Use this sketch when running the Liberty Arduino Feature test suite.
*/
#include <EEPROM.h>
#include <Liberty.h>
Liberty liberty("TestNode");
boolean ns = false;
int nc = 0;
unsigned long ln;
byte bs[50];
void setup() {
liberty.sram(bs, 50);
liberty.invocable("foo", &foo)... |
b0abaf72-f827-4682-acee-4e16fb511ef5 | {
"language": "Arduino"
} | ```arduino
// https://github.com/thomasfredericks/Metro-Arduino-Wiring
#include <Metro.h>
const int MOTORPIN = 2;
Metro blink = Metro(400);
bool isVibrationOn = false;
bool isMotorOn = false;
uint32_t now;
void onMotor(void)
{
digitalWrite(MOTORPIN, HIGH);
isMotorOn = true;
}
void offMotor(void)
{
digit... | ```arduino
// https://www.pjrc.com/teensy/td_libs_TimerOne.html
#include <TimerThree.h>
const int MOTORPIN = 5;
void parseMessage(int letter)
{
switch (letter) {
case 'v':
Timer3.pwm(MOTORPIN, 512);
break;
case 'V':
Timer3.pwm(MOTORPIN, 0);
break;
default:
break... |
21e81dcf-5aa9-49eb-94e5-3586c63e3a2e | {
"language": "Arduino"
} | ```arduino
int incomingByte = 0; // for incoming serial data
int relay1 = 4;
int relay2 = 5;
boolean state1 = false;
boolean state2 = false;
void setup() {
Serial.begin(9600);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
incomingByte = Serial.read();
if ... | ```arduino
int incomingByte = 0; // for incoming serial data
int relay1 = 4;
int relay2 = 5;
boolean state1 = false;
boolean state2 = false;
void setup() {
Serial.begin(9600);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
incomingByte = Serial.read();
... |
c7a8b257-ae45-4354-85b0-7e2bee053f4d | {
"language": "Arduino"
} | ```arduino
/**
* Wrapper for a thermometer.
*
* In this case it's a BMP085 barometric sensor, because that's what I had laying around.
*/
#include <Wire.h>
#include <I2Cdev.h>
#include <BMP085.h>
BMP085 barometer;
boolean hasThermometer;
boolean initThermometer () {
Serial.print(F("Setting up BMP085 for temper... | ```arduino
/**
* Wrapper for a thermometer.
*
* In this case it's a BMP085 barometric sensor, because that's what I had laying around.
*/
#include <Wire.h>
#include <Adafruit_BMP085.h>
Adafruit_BMP085 barometer;
boolean hasThermometer;
boolean initThermometer () {
Serial.print(F("Setting up BMP085 for temperat... |
002691f7-a3e6-4d96-ae30-5831651be9e6 | {
"language": "Arduino"
} | ```arduino
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
```
Implement initial setup for Wave Shield | ```arduino
#include <WaveHC.h>
#include <WaveUtil.h>
SdReader card; // This object holds the information for the card
FatVolume vol; // This holds the information for the partition on the card
FatReader root; // This holds the information for the volumes root directory
WaveHC wave; // This is the only wa... |
02e50770-6971-42a3-ab17-5ca3c8018f48 | {
"language": "Arduino"
} | ```arduino
/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic... | ```arduino
/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic... |
8357f55a-203b-48a1-8be1-89498def190a | {
"language": "Arduino"
} | ```arduino
const int PIN_DATA = 4;
const int PIN_LATCH = 3;
const int PIN_CLOCK = 2;
byte arrivalStatus = 1;
void setup() {
pinMode(PIN_DATA, OUTPUT);
pinMode(PIN_CLOCK, OUTPUT);
pinMode(PIN_LATCH, OUTPUT);
}
void loop() {
digitalWrite(PIN_LATCH, LOW);
shiftOut(PIN_DATA, PIN_CLOCK, MSBFIRST, arri... | ```arduino
const int PIN_DATA = 4;
const int PIN_LATCH = 3;
const int PIN_CLOCK = 2;
void setup() {
//Initialize Shift register
pinMode(PIN_DATA, OUTPUT);
pinMode(PIN_CLOCK, OUTPUT);
pinMode(PIN_LATCH, OUTPUT);
//Initialize Serial Port
Serial.begin(9600);
}
void loop() {
//Wait for a sing... |
388d68b1-2846-494b-8559-217a66558840 | {
"language": "Arduino"
} | ```arduino
const byte SCALE_VALUE[] = { 0b00000100, 0b00001100, 0b00011100, 0b00111100};
int senzor = A0;
void setup() {
Serial.begin(9600);
pinMode(senzor, INPUT);
// porty 2,3,4,5 jako vystup
DDRD |= 0b00111100;
}
void loop() {
int light = analogRead(senzor);
Serial.println(light);
int scale = map... | ```arduino
const byte SCALE_VALUE[] = { 0b00000100, 0b00001100, 0b00011100, 0b00111100};
// fotorezistor - A1, termistor - A0
int senzor = A1;
void setup() {
Serial.begin(9600);
pinMode(senzor, INPUT);
// porty 2,3,4,5 jako vystup
DDRD |= 0b00111100;
}
void loop() {
int light = analogRead(senzor);
Serial... |
d244ce8f-82d6-491f-9e7f-593a03a50edd | {
"language": "Arduino"
} | ```arduino
void setup() {
Serial.begin(9600);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
... | ```arduino
void setup() {
Serial.begin(9600);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
... |
d410e246-546d-4ad4-9520-48f5a2d95660 | {
"language": "Arduino"
} | ```arduino
#define LED 53
void setup()
{
pinMode(LED, OUTPUT);
}
void loop()
{
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
}
```
Add blank line for tuto sample. | ```arduino
#define LED 53
void setup()
{
pinMode(LED, OUTPUT);
}
void loop()
{
digitalWrite(LED, HIGH);
delay(500);
digitalWrite(LED, LOW);
delay(500);
}
``` |
5d7fa53d-8feb-4e12-ae5d-53aed9b8ce2a | {
"language": "Arduino"
} | ```arduino
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
```
Revert "make editor folding happy" | ```arduino
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
``` |
ad189790-e95c-4447-b0a6-216f8ea525bf | {
"language": "Arduino"
} | ```arduino
#include <MINDS-i-Drone.h>
ServoGenerator::Servo drive, steer;
void setup() {
drive.attach(12 /* APM pin 1 */);
steer.attach(11 /* APM pin 2 */);
ServoGenerator::begin();
//set the initial throttle/direction for the ESC/servo
drive.write(90);
steer.write(90);
APMRadio::setup();
Serial.be... | ```arduino
#include <MINDS-i-Drone.h>
ServoGenerator::Servo drive, steer, backsteer;
void setup() {
drive.attach(12 /* APM pin 1 */);
steer.attach(11 /* APM pin 2 */);
backsteer.attach(8 /* APM pin 3 */);
ServoGenerator::begin();
//set the initial throttle/direction for the ESC/servo
drive.write(90);
... |
8f28f284-9e8b-44cd-9e97-66345ffa3ef5 | {
"language": "Arduino"
} | ```arduino
/*
Arduino based self regulating kitchen garden
*/
#include <DHT.h>
// temperature related setup
#define DHTPIN 2 // Humidity and temperature sensor pin
#define DHTTYPE DHT22 // Model DHT 22 (AM2302)
DHT airSensor(DHTPIN, DHTTYPE); // setup DHT sensor
float airHumidity;
float airTemperature;
... | ```arduino
/*
Arduino based self regulating kitchen garden
*/
#include <SHT1x.h>
#include <DHT.h>
// soil related setup
#define soilDataPin 3
#define soilClockPin 4
SHT1x soilSensor(soilDataPin, soilClockPin);
float soilTemperature;
float soilMoisture;
// air temperature related setup
#define DHTPIN 2 // ... |
e28f95bb-7ca6-4b4d-b806-49d7ceff0af4 | {
"language": "Arduino"
} | ```arduino
#ifndef BOLTARDUINO
#define BOLTARDUINO
#include "button.h"
#include "led.h"
#include "screen.h"
#include "game.h"
#include "const.h"
#include "clock.h"
void setup() {
Serial.begin(115200);
//Attach interrupt for 64 button shield
attachInterrupt(digitalPinToInterrupt(P_BUTTON_INTERRUPT), button_IS... | ```arduino
#ifndef BOLTARDUINO
#define BOLTARDUINO
#include "button.h"
#include "led.h"
#include "screen.h"
#include "game.h"
#include "const.h"
#include "clock.h"
#include "controller.h"
void setup() {
Serial.begin(115200);
//Attach interrupt for 64 button shield
attachInterrupt(digitalPinToInterrupt(P_BUTT... |
6e7bc549-9af7-4364-8632-273f9866f78f | {
"language": "Arduino"
} | ```arduino
#include <RunningAverage.h>
#include <HX711.h>
#include "TimerDisplay.h"
#include "GramsDisplay.h"
#define DISP_TIMER_CLK 2
#define DISP_TIMER_DIO 3
#define DISP_SCALE_CLK 8
#define DISP_SCALE_DIO 9
#define SCALE_DT A2
#define SCALE_SCK A1
#define FILTER_SIZE 10
#define SCALE_FACTOR 1874
#defi... | ```arduino
#include <RunningAverage.h>
#include <HX711.h>
#include "TimerDisplay.h"
#include "GramsDisplay.h"
#define DISP_TIMER_CLK 2
#define DISP_TIMER_DIO 3
#define DISP_SCALE_CLK 8
#define DISP_SCALE_DIO 9
#define SCALE_DT A2
#define SCALE_SCK A1
#define FILTER_SIZE 10
#define SCALE_FACTOR 1874
#defi... |
9e87bd28-aa3d-4ebe-ab58-f414afbb6e19 | {
"language": "Arduino"
} | ```arduino
#include <Bridge.h>
#include "logger.h"
#include "thingspeakReceiver.h"
ThingspeakReceiver thingspeakReceiver;
#include <Adafruit_LEDBackpack.h>
#include <Adafruit_GFX.h>
#include <Wire.h>
#define PIN_LED 13
Adafruit_7segment matrix = Adafruit_7segment();
void setup() {
pinMode(PIN_LED, OUTPUT);
... | ```arduino
#include <Bridge.h>
#include "logger.h"
/////////////////////////////////////////////
// Include of Iot Platform's connectors
#include "thingspeakReceiver.h"
ThingspeakReceiver thingspeakReceiver;
int thingsSpeakCounter = 0;
#include "shiftrConnector.h"
ShiftrConnector shiftrConnector;
int shiftrCounter =... |
9cb2ca8c-f0b9-494c-963b-45179e5d4b63 | {
"language": "Arduino"
} | ```arduino
#include <M5Stack.h>
// the setup routine runs once when M5Stack starts up
void setup(){
// initialize the M5Stack object
M5.begin();
// Lcd display
M5.Lcd.println("This is software power off demo");
M5.Lcd.println("Press the button A to power off.");
// Set the wakeup button
M5.Power.set... | ```arduino
#include <M5Stack.h>
// the setup routine runs once when M5Stack starts up
void setup(){
// initialize the M5Stack object
M5.begin();
// Lcd display
M5.Lcd.println("This is software power off demo");
M5.Lcd.println("Press the button A to power off.");
}
// the loop routine runs over and over ag... |
b6d00218-d56e-4e37-abd1-46432d1994b6 | {
"language": "Arduino"
} | ```arduino
#include <Bridge.h>
#include "thingspeakReceiver.h"
ThingspeakReceiver thingspeakReceiver;
#include <Adafruit_LEDBackpack.h>
#include <Adafruit_GFX.h>
#include <Wire.h>
#define PIN_LED_KO 12
#define PIN_LED_OK 13
Adafruit_7segment matrix = Adafruit_7segment();
void setup() {
pinMode(PIN_LED_KO, ... | ```arduino
#include <Bridge.h>
#include "logger.h"
#include "thingspeakReceiver.h"
ThingspeakReceiver thingspeakReceiver;
#include <Adafruit_LEDBackpack.h>
#include <Adafruit_GFX.h>
#include <Wire.h>
#define PIN_LED 13
Adafruit_7segment matrix = Adafruit_7segment();
void setup() {
pinMode(PIN_LED, OUTPUT);
... |
921b8385-af8d-4647-a74e-a0784814d24e | {
"language": "Arduino"
} | ```arduino
#include <SPI.h>
#define SPI_READ_CMD 0x03
#define CS_PIN 10
unsigned int num_bytes;
unsigned int i;
void setup() {
Serial.begin(115200);
pinMode(CS_PIN, OUTPUT);
digitalWrite(CS_PIN, HIGH);
SPI.begin();
}
void read_eeprom(unsigned int num_bytes) {
unsigned int addr;
byte resp;
digitalWri... | ```arduino
#include <SPI.h>
#define SPI_READ_CMD 0x03
#define CS_PIN 10
void setup() {
Serial.begin(115200);
pinMode(CS_PIN, OUTPUT);
digitalWrite(CS_PIN, HIGH);
SPI.begin();
}
void read_eeprom(unsigned int num_bytes) {
unsigned int addr;
byte resp;
digitalWrite(CS_PIN, LOW);
/* transmit read comm... |
07afc135-6874-4eea-aa2f-afbd352929a9 | {
"language": "Arduino"
} | ```arduino
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
static constexpr unsigned long TimeChunk = 2 * 1000;
static LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
static unsigned long endTime;
static bool previousPressed;
void setup()
{
lcd.begin(16,2);
lcd.backlight();
pinMode(A0, INPUT_PULL... | ```arduino
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
static constexpr unsigned long TimeChunk = 2 * 1000;
static LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
static unsigned long endTime;
static bool previousPressed;
void setup()
{
lcd.begin(16,2);
lcd.backlight();
pinMode(A0, INPUT_PULL... |
e0f36114-83dc-4a34-8ca8-9c8b21c773b8 | {
"language": "Arduino"
} | ```arduino
#include "pn532_i2c_particle/pn532_i2c_particle.h"
#include "pn532_i2c_particle/PN532.h"
#include "pn532_i2c_particle/NfcAdapter.h"
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
void setup(void) {
Serial.begin(9600);
Serial.println("NDEF Reader");
nfc.begin();
}
void loop(... | ```arduino
#include "pn532_i2c_particle/pn532_i2c_particle.h"
#include "pn532_i2c_particle/PN532.h"
#include "pn532_i2c_particle/NfcAdapter.h"
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
void setup(void) {
Serial.begin(9600);
Serial.println("NDEF Reader");
nfc.begin();
}
void loop(... |
988af812-87a3-49af-8429-13fcf74a5a26 | {
"language": "Arduino"
} | ```arduino
#include "Wire.h"
#include "SPI.h"
#include "MINDS-i-Drone.h"
#include "platforms/Quadcopter.h"
void setup(){
calibrateESCs();
}
void loop(){
output.stop();
}
```
Disable the output after calibrating instead of deprecated stop | ```arduino
#include "Wire.h"
#include "SPI.h"
#include "MINDS-i-Drone.h"
#include "platforms/Quadcopter.h"
void setup(){
calibrateESCs();
output.disable();
}
void loop(){
}
``` |
0ad84d52-cc58-46cc-ae8c-c545ff26b7fa | {
"language": "Arduino"
} | ```arduino
#include <M5Stack.h>
// the setup routine runs once when M5Stack starts up
void setup(){
// initialize the M5Stack object
M5.begin();
// Lcd display
M5.Lcd.println("This is software power off demo");
M5.Lcd.println("Press the button A to power off.");
// Set the wakeup button
M5.setWakeup... | ```arduino
#include <M5Stack.h>
// the setup routine runs once when M5Stack starts up
void setup(){
// initialize the M5Stack object
M5.begin();
// Lcd display
M5.Lcd.println("This is software power off demo");
M5.Lcd.println("Press the button A to power off.");
// Set the wakeup button
M5.Power.set... |
d7c0ab36-fc1d-48c6-b0df-3a3ae0e0efc5 | {
"language": "Arduino"
} | ```arduino
#include "lcd.h"
#include "sensor.h"
void setup() {
LCD::setup();
LCD::helloworld();
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
```
Remove useless comments from ino | ```arduino
#include "lcd.h"
#include "sensor.h"
void setup() {
LCD::setup();
LCD::helloworld();
}
void loop() {
}
``` |
d0901e5e-4ec8-4426-aaee-f961bd8d8d0f | {
"language": "Arduino"
} | ```arduino
#include "receiver.h"
Receiver rx1 = Receiver(2, 3, 4);
Receiver rx2 = Receiver(2, 3, 5);
Receiver rx3 = Receiver(2, 3, 6);
Receiver rx4 = Receiver(2, 3, 7);
void setup() {
// Wait for modules to settle.
delay(1000);
// Set to race frequencies.
rx1.setFrequency(5665);
rx2.setFrequenc... | ```arduino
#include "receiver.h"
Receiver rx1 = Receiver(2, 3, 4);
Receiver rx2 = Receiver(2, 3, 5);
Receiver rx3 = Receiver(2, 3, 6);
Receiver rx4 = Receiver(2, 3, 7);
void setup() {
// Wait for modules to settle.
delay(2000);
// Set to race frequencies.
rx1.setFrequency(5805);
delay(500);
... |
b3836f75-3660-4b89-aa72-9251864af334 | {
"language": "Arduino"
} | ```arduino
#include "button.h"
#include "led.h"
#include "screen.h"
#include "game.h"
#include "clock.h"
#include "const.h"
#include "controller.h"
#include "flasher.h"
#include "logger.h"
void setup() {
Serial.begin(115200);
//Attach interrupt for 64 button shield
attachInterrupt(digitalPinToInterrupt(P_BUTTO... | ```arduino
#include "button.h"
#include "led.h"
#include "screen.h"
#include "game.h"
#include "clock.h"
#include "const.h"
#include "controller.h"
#include "flasher.h"
#include "logger.h"
void setup() {
Serial.begin(115200);
//Attach interrupt for 64 button shield
attachInterrupt(digitalPinToInterrupt(P_BUTTO... |
87066902-3887-494a-a552-80e294e5de98 | {
"language": "Arduino"
} | ```arduino
#include "button.h"
#include "led.h"
#include "screen.h"
#include "game.h"
#include "timer.h"
#include "const.h"
#include "controller.h"
#include "flasher.h"
#include "logger.h"
#include "helper.h"
void setup() {
Serial.begin(115200);
//Generate new random seed
randomSeed(analogRead(0));
//Setup
... | ```arduino
#include "button.h"
#include "led.h"
#include "screen.h"
#include "game.h"
#include "timer.h"
#include "const.h"
#include "controller.h"
#include "flasher.h"
#include "logger.h"
#include "helper.h"
void setup() {
Serial.begin(115200);
//Generate new random seed
randomSeed(analogRead(0));
//Setup
... |
73d766a0-93b5-4c01-b983-e58e5fd71e26 | {
"language": "Arduino"
} | ```arduino
/*
Author: Andrea Stagi <stagi.andrea@gmail.com>
Example: ReadAll
Description: fetch all devices and relative temperatures
on the wire bus on pin 5 and send them via serial port.
*/
#include <OneWire.h>
#include <DSTemperature.h>
DSTemperature ds(5); // on pin 5
void setup(void) {
Serial.begin(... | ```arduino
/*
Author: Andrea Stagi <stagi.andrea@gmail.com>
Example: ReadAll
Description: fetch all devices and relative temperatures
on the wire bus on pin 5 and send them via serial port.
*/
#include <OneWire.h>
#include <DSTemperature.h>
DSTemperature ds(5); // on pin 5
void setup(void) {
Serial.begin(... |
1e7a8815-7989-4ad5-9f0d-0ea97ced036c | {
"language": "Arduino"
} | ```arduino
#include "Constants.h"
#include "Display.h"
#include "Buttons.h"
Display display;
Buttons buttons;
unsigned long start_time = 0;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
start_time = millis();
}
void loop() {
unsigned long current_time = millis() - start_time;
display.displayTi... | ```arduino
#include "Constants.h"
#include "Display.h"
#include "Buttons.h"
Display display;
Buttons buttons;
unsigned long countdown_ends;
unsigned long countdown_duration;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
countdown_ends = 0;
countdown_duration = 900000; // 15 mins in ms
countdown_... |
8015b864-9854-4aea-9383-8955d6f91710 | {
"language": "Arduino"
} | ```arduino
#include <ros.h>
ros::NodeHandle nh;
std_msgs::Float64 state;
void callback(const std_msgs::Float64 cmd);
{
}
ros::Publisher state_pub("state", &state);
ros::Subscriber<std_msgs::Float64> cmd_sub("command", &callback);
void setup()
{
nh.initNode();
nh.advertise(state_pub);
}
void loop()
{
nh.spi... | ```arduino
#include <Wire.h>
#include <ros.h>
#include <std_msgs/Int8.h>
ros::NodeHandle nh;
std_msgs::Int8 state;
ros::Publisher state_pub("state", &state);
void callback(const std_msgs::Int8 &cmd)
{
state.data = 0;
state_pub.publish(&state);
Wire.beginTransmission(3);
Wire.write(0x10);
Wire.write(0x10... |
8761f629-95fa-4823-881f-84ee9f970301 | {
"language": "Arduino"
} | ```arduino
/**
* Use this sketch to talk directly to the LoRa module.
*
* In Serial Monitor, select "Both NL & CR" and "9600 baud" in
* the bottom right dropdowns and send command a command like:
*
* mac get deveui
* sys reset
*/
#define loraSerial Serial1
#define debugSerial Serial
void setup() {
loraSeri... | ```arduino
/**
* Use this sketch to talk directly to the LoRa module.
*
* In Serial Monitor, select "Both NL & CR" and "115200 baud" in
* the bottom right dropdowns and send command a command like:
*
* mac get deveui
* sys reset
*/
#define loraSerial Serial1
#define debugSerial Serial
void setup() {
while(... |
6c501d79-a66f-4a8f-9f83-5983f68a8f18 | {
"language": "Arduino"
} | ```arduino
#include <M5Stack.h>
// the setup routine runs once when M5Stack starts up
void setup(){
// initialize the M5Stack object
M5.begin();
// Lcd display
M5.Lcd.println("This is software power off demo");
M5.Lcd.println("Press the button A to power off.");
// Set the wakeup button
M5.Power.set... | ```arduino
#include <M5Stack.h>
// the setup routine runs once when M5Stack starts up
void setup(){
// initialize the M5Stack object
M5.begin();
// Lcd display
M5.Lcd.println("This is software power off demo");
M5.Lcd.println("Press the button A to power off.");
// Set the wakeup button
M5.Power.set... |
bb71be24-3242-49bc-b7d3-3d73ca16cc25 | {
"language": "Arduino"
} | ```arduino
/*
This example is basically the same as SimpleSerialPrinter but utilize
the EnableInterrupt library. EnableInterrupt make pin change
interrupts available and thus allows to use arbitrary pins.
*/
// EnableInterrupt from https://github.com/GreyGnome/EnableInterrupt
// include it before RadiationWatch.h
#in... | ```arduino
/*
This example is basically the same as SimpleSerialPrinter but utilize
the EnableInterrupt library.
The EnableInterrupt library make pin change interrupts available and
thus allows to use arbitrary pins.
See a list of pins supported here:
https://github.com/GreyGnome/EnableInterrupt/wiki/Usage#pin--port-... |
947acf9c-5985-4132-b096-34749a4a6ef5 | {
"language": "Arduino"
} | ```arduino
#include "pn532_i2c_particle/pn532_i2c_particle.h"
#include "pn532_i2c_particle/PN532.h"
#include "pn532_i2c_particle/NfcAdapter.h"
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
void setup(void) {
Serial.begin(9600);
Serial.println("NDEF Reader");
nfc.begin();
}
void loop(... | ```arduino
#include "pn532_i2c_particle/pn532_i2c_particle.h"
#include "pn532_i2c_particle/PN532.h"
#include "pn532_i2c_particle/NfcAdapter.h"
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
void setup(void) {
Serial.begin(9600);
Serial.println("NDEF Reader");
nfc.begin();
}
void loop(... |
d01d745a-5652-4c11-a20d-bcaa2d06f470 | {
"language": "Arduino"
} | ```arduino
#include <FastLED.h>
#define WIDTH 16
#define HEIGHT 16
#define NUM_LEDS (WIDTH * HEIGHT)
#define PIN 6
#define BAUD 115200
#define BRIGHTNESS 32
CRGB leds[NUM_LEDS];
int r, g, b;
int x, y, yy;
void setup() {
FastLED.addLeds<WS2812B, PIN>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBri... | ```arduino
#include <FastLED.h>
#define WIDTH 16
#define HEIGHT 16
#define NUM_LEDS (WIDTH * HEIGHT)
#define PIN 6
#define BAUD 115200
#define BRIGHTNESS 8
CRGB leds[NUM_LEDS];
int r, g, b;
int x, y, yy;
void setup() {
FastLED.addLeds<WS2812B, PIN>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrig... |
ec19912b-7444-46eb-a664-96aff35f152f | {
"language": "Arduino"
} | ```arduino
#include <MiniRobot.h>
MiniRobot robot;
void setup() {
}
void loop() {
if (robot.leftEdge() && robot.distanceToEnemy() == 0) {
robot.leftBack();
} else {
robot.leftForward();
}
if (robot.rightEdge() && robot.distanceToEnemy() == 0) {
robot.rightBack();
} else {
robot.rightForward... | ```arduino
#include <MiniRobot.h>
MiniRobot robot;
byte status = 2;
/*
0 - don't need changes;
1 - counter only
2 - drive straight back;
3 - drive straight forward;
4 - spin around
- enemy forward;
*/
int count = 0;
void setup() {
PCMSK1 |= bit(0) | bit(1);
PCIFR |= bit(1);
PCICR |= bit(1);
pinMode(A0,IN... |
eff07b90-e17e-415f-80fa-a93f003f6567 | {
"language": "Arduino"
} | ```arduino
#include "Watering.h"
void setup () {
//Init serial connection
Serial.begin(SERIAL_BAUD);
//Init LED Pin
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
}
void loop() {
if ( Serial.available() ) {
byte command = Serial.read();
switch( command ) {
case WATER_LEVEL:
... | ```arduino
#include "Watering.h"
void setup () {
//Init serial connection
Serial.begin(SERIAL_BAUD);
//Init LED Pin
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
}
void loop() {
if ( Serial.available() ) {
byte command = Serial.read();
byte output[4];
byte numBytes = 0;
switc... |
8b3d03c4-0280-437e-ab79-961ab3aa4c54 | {
"language": "Arduino"
} | ```arduino
/*
Pines of the first sensor.
*/
#define S1echo 7
#define S1trig 8
/*
Pines of the second sensor.
*/
#define S2echo 10
#define S2trig 11
long duration, distance;
void setup() {
/*
Setup of the echo & trig of everysensor.
*/
pinMode(S1echo, INPUT);
//pinMode(S2echo, INPUT);
pinMode(S1trig, OU... | ```arduino
/*
Pines of the first sensor.
*/
#define S1echo 7
#define S1trig 8
/*
Pines of the second sensor.
*/
#define S2echo 10
#define S2trig 11
long duration, distance;
void setup() {
Serial.begin(9600);
/*
Setup of the echo & trig of everysensor.
*/
pinMode(S1echo, INPUT);
//pinMode(S2echo, INPUT)... |
5929f704-3ddf-40d7-9dd0-da7132368a1a | {
"language": "Arduino"
} | ```arduino
/**************************************************************
* Blynk is a platform with iOS and Android apps to control
* Arduino, Raspberry Pi and the likes over the Internet.
* You can easily build graphic interfaces for all your
* projects by simply dragging and dropping widgets.
*
* Downloads,... | ```arduino
/**************************************************************
* Blynk is a platform with iOS and Android apps to control
* Arduino, Raspberry Pi and the likes over the Internet.
* You can easily build graphic interfaces for all your
* projects by simply dragging and dropping widgets.
*
* Downloads,... |
3c9b7486-4dd5-477f-8f0e-093a47581127 | {
"language": "Arduino"
} | ```arduino
#include <Homie.h>
const int doorPin = 16;
Bounce debouncer = Bounce(); // Bounce is built into Homie, so you can use it without including it first
unsigned long lastDoorValue = -1;
HomieNode doorNode("door", "door");
void loopHandler() {
int doorValue = debouncer.read();
if (doorValue != lastDoorVa... | ```arduino
#include <Homie.h>
const int PIN_DOOR = 16;
Bounce debouncer = Bounce(); // Bounce is built into Homie, so you can use it without including it first
unsigned long lastDoorValue = -1;
HomieNode doorNode("door", "door");
void loopHandler() {
int doorValue = debouncer.read();
if (doorValue != lastDoorV... |
766ee8de-15ef-476c-8c9f-e64844c32f93 | {
"language": "Arduino"
} | ```arduino
// Moving Average Example
// Shows how to use an FIR filter as a moving average on a simple
// set of data that can be easily verified by hand.
#include <FIR.h>
// Make an instance of the FIR filter. In this example we'll use
// floating point values and an 8 element filter. For a moving average
// that me... | ```arduino
// Moving Average Example
// Shows how to use an FIR filter as a moving average on a simple
// set of data that can be easily verified by hand.
#include <FIR.h>
// Make an instance of the FIR filter. In this example we'll use
// floating point values and an 8 element filter. For a moving average
// that me... |
871262bf-f7e0-4066-b80c-8edb1858d5c5 | {
"language": "Arduino"
} | ```arduino
#include <Smartcar.h>
SR04 front;
const int TRIGGER_PIN = 6; //D6
const int ECHO_PIN = 7; //D7
void setup() {
Serial.begin(9600);
front.attach(TRIGGER_PIN, ECHO_PIN); //trigger pin, echo pin
}
void loop() {
Serial.println(front.getDistance());
delay(100);
}
```
Update SR04 example to new 5.0 API | ```arduino
#include <Smartcar.h>
const int TRIGGER_PIN = 6; //D6
const int ECHO_PIN = 7; //D7
SR04 front(TRIGGER_PIN, ECHO_PIN, 10);
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(front.getDistance());
delay(100);
}
``` |
012040db-740e-4d99-931a-7d1e264ad63a | {
"language": "Arduino"
} | ```arduino
int vinpin = A0;
int voutpin = A1;
int gndpin = A2;
int zpin = A3;
int ypin = A4;
int xpin = A5;
void setup() {
Serial.begin(115200);
pinMode(vinpin, OUTPUT); digitalWrite(vinpin, HIGH);
pinMode(gndpin, OUTPUT); digitalWrite(gndpin, LOW);
pinMode(voutpin, INPUT);
pinMode(xpin, INPUT);
pinMode(yp... | ```arduino
int vinpin = A0;
int voutpin = A1;
int gndpin = A2;
int zpin = A3;
int ypin = A4;
int xpin = A5;
void setup() {
Serial.begin(9600);
pinMode(vinpin, OUTPUT); digitalWrite(vinpin, HIGH);
pinMode(gndpin, OUTPUT); digitalWrite(gndpin, LOW);
pinMode(voutpin, INPUT);
pinMode(xpin, INPUT);
pinMode(ypin... |
45637e83-aa0e-468d-93d3-356f46f0f5f1 | {
"language": "Arduino"
} | ```arduino
#include <Wire.h>
// begin SD card libraries
#include <BlockDriver.h>
#include <FreeStack.h>
#include <MinimumSerial.h>
#include <SdFat.h>
#include <SdFatConfig.h>
#include <SysCall.h>
// end SD card libraries
#include "Bmp180.h" // RCR header
File file; // file object
//SdFatSdio sd_card; // MicroSD card... | ```arduino
#include <Wire.h>
// begin SD card libraries
#include <BlockDriver.h>
#include <FreeStack.h>
#include <MinimumSerial.h>
#include <SdFat.h>
#include <SdFatConfig.h>
#include <SysCall.h>
// end SD card libraries
#include "Bmp180.h" // RCR header
namespace rcr {
namespace level1payload {
Bmp180 bmp;
File fi... |
026171c0-66a9-42d7-a540-2cfd5cd19759 | {
"language": "Arduino"
} | ```arduino
#include <stdint.h>
#include "zg01_fsm.h"
#define PIN_CLOCK 2
#define PIN_DATA 3
#define PIN_LED 13
static uint8_t buffer[5];
void setup(void)
{
// initialize ZG01 pins
pinMode(PIN_CLOCK, INPUT);
pinMode(PIN_DATA, INPUT);
// initialize LED
pinMode(PIN_LED, OUTPUT);
// i... | ```arduino
#include <stdint.h>
#include "zg01_fsm.h"
#define PIN_CLOCK 2
#define PIN_DATA 3
#define PIN_LED 13
static uint8_t buffer[5];
void setup(void)
{
// initialize ZG01 pins
pinMode(PIN_CLOCK, INPUT);
pinMode(PIN_DATA, INPUT);
// initialize LED
pinMode(PIN_LED, OUTPUT);
// i... |
8ace0c3f-38ca-4875-8b8e-202c5759fff5 | {
"language": "Arduino"
} | ```arduino
//
// FaBo AmbientLight Brick
//
// brick_i2c_ambientlight
//
#include <Wire.h>
#include "fabo-isl29034.h"
void setup()
{
Serial.begin(115200);
faboAmbientLight.configuration();
faboAmbientLight.powerOn();
}
void loop()
{
double ambient = faboAmbientLight.readData();
Serial.print("Ambient:... | ```arduino
//
// FaBo AmbientLight Brick
//
// brick_i2c_ambientlight
//
#include <Wire.h>
#include "fabo-isl29034.h"
FaBoAmbientLight faboAmbientLight;
void setup()
{
Serial.begin(115200);
faboAmbientLight.configuration();
faboAmbientLight.powerOn();
}
void loop()
{
double ambient = faboAmbientLight.r... |
684bbefe-251d-4144-8a3e-b8eee58a036d | {
"language": "Arduino"
} | ```arduino
// This provides a variable, colour, a function to set the variable from a hex
// string, set_colour, and programs the RGB LED on the spark core to reflect
// the RRGGBB value last programmed. The default on reboot is black.
// BEWARE: British spelling ahead!
#include "spark-parse.h"
static int colour = ... | ```arduino
#include "spark-parse/spark-parse.h"
// This provides a variable, colour, a function to set the variable from a hex
// string, set_colour, and programs the RGB LED on the spark core to reflect
// the RRGGBB value last programmed. The default on reboot is black.
// BEWARE: British spelling ahead!
static i... |
84734ee8-5a09-4515-b209-5f543284ddcc | {
"language": "Arduino"
} | ```arduino
/*
String replace()
Examples of how to replace characters or substrings of a string
created 27 July 2010
modified 2 Apr 2012
by Tom Igoe
Hardware Required:
* MSP-EXP430G2 LaunchPad
This example code is in the public domain.
*/
void setup() {
// Open serial communicati... | ```arduino
/*
String replace()
Examples of how to replace characters or substrings of a string
created 27 July 2010
modified 2 Apr 2012
by Tom Igoe
Hardware Required:
* MSP-EXP430G2 LaunchPad
This example code is in the public domain.
*/
void setup() {
// Open serial communicati... |
08ac8abd-b7e1-41fe-a5a4-f0034585711a | {
"language": "Arduino"
} | ```arduino
const int buttonPin = 2;
int buttonState = 0;
void setup() {
Serial.begin(9600);
pinMode(buttonPin, INPUT);
}
void loop() {
int randNum = random(300);
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
Serial.println(randNum);
}
delay(500);
}
```
Update delay time for a... | ```arduino
const int buttonPin = 2;
int buttonState = 0;
void setup() {
Serial.begin(9600);
pinMode(buttonPin, INPUT);
}
void loop() {
int randNum = random(300);
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
Serial.println(randNum);
while(buttonState) {
buttonState = dig... |
1b654d92-9de5-4338-b6a1-4b1bc08dc4ce | {
"language": "Arduino"
} | ```arduino
/*
Battery indicator on the TFT screen.
*/
#include <ArduinoRobot.h>
#include "RobotBattery.h"
RobotBattery battery = RobotBattery();
int bat_val_prev = 0;
void setup() {
// initialize the robot
Robot.begin();
// initialize the screen
Robot.beginTFT();
// Black screen
Robot.backgrou... | ```arduino
/*
Battery indicator on the TFT screen.
*/
#include <ArduinoRobot.h>
#include "RobotBattery.h"
RobotBattery battery = RobotBattery();
int bat_val_prev = 0;
void setup() {
// initialize the robot
Robot.begin();
// initialize the screen
Robot.beginTFT();
// Black screen
Robot.backgrou... |
c7b45266-6072-4af9-b1b8-e4a7971f3681 | {
"language": "Arduino"
} | ```arduino
//Pin connected to ST_CP of 74HC595
const int latchPin = 12;
//Pin connected to SH_CP of 74HC595
const int clockPin = 11;
////Pin connected to DS of 74HC595
const int dataPin = 13;
void setup() {
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
// coun... | ```arduino
//Pin connected to ST_CP of 74HC595
const int LATCHPIN = 12;
//Pin connected to SH_CP of 74HC595
const int CLOCKPIN = 11;
// Pin connected to DS of 74HC595
const int DATAPIN = 13;
// Number of pins
const int BOARDHEIGHT = 5;
// Delay
const int DELAY = 200;
void sendData(byte data) {
// 001010
for (int i... |
ffc00f07-8fdd-4d79-8ce7-f400002a7ec9 | {
"language": "Arduino"
} | ```arduino
//
// Generate a signal to trigger camera and lightning
//
// Setup
int button = 7;
int trigger = 13;
boolean running = false;
int button_state;
int last_button_state = LOW;
int high_duration = 10;
int low_duration = 190; // 5Hz
//int low_duration = 101; // 9Hz
// Arduino setup
void setup() {
// Input-O... | ```arduino
//
// Generate a 9Hz signal to trigger camera and lightning
//
// Setup
int button = 7;
int trigger = 13;
boolean running = false;
int button_state;
int last_button_state = LOW;
int high_duration = 10;
int low_duration = 101;
// Arduino setup
void setup() {
// Input-Output signals
pinMode( button, INP... |
e3bd0aaa-c9bc-435e-84bf-ec2367baba17 | {
"language": "Arduino"
} | ```arduino
// RFID_UART.ino
#if defined (SPARK)
#include "SeeedRFID/SeeedRFID.h"
#else
#include <SoftwareSerial.h>
#include <SeeedRFID.h>
#endif
#define RFID_RX_PIN 10
#define RFID_TX_PIN 11
// #define DEBUG
#define TEST
SeeedRFID RFID(RFID_RX_PIN, RFID_TX_PIN);
RFIDdata tag;
void setup() {
Serial1.begin(9600); /... | ```arduino
// RFID_UART.ino
#if defined (SPARK)
#include "SeeedRFID/SeeedRFID.h"
#else
#include <SoftwareSerial.h>
#include <SeeedRFID.h>
#endif
#define RFID_RX_PIN 10
#define RFID_TX_PIN 11
// #define DEBUGRFID
#define TEST
SeeedRFID RFID(RFID_RX_PIN, RFID_TX_PIN);
RFIDdata tag;
void setup() {
Serial1.begin(9600... |
0e500b18-715d-448e-80cb-9a61cac9369f | {
"language": "Arduino"
} | ```arduino
/**
* Display the voltage measured at four 16-bit channels.
*
* Copyright (c) 2014 Circuitar
* All rights reserved.
*
* This software is released under a BSD license. See the attached LICENSE file for details.
*/
#include <Wire.h>
#include <Nanoshield_ADC.h>
Nanoshield_ADC adc[4] = { 0x48, 0x49, 0x4A... | ```arduino
/**
* Display the voltage measured at four 16-bit channels.
*
* Copyright (c) 2014 Circuitar
* All rights reserved.
*
* This software is released under a BSD license. See the attached LICENSE file for details.
*/
#include <Wire.h>
#include <Nanoshield_ADC.h>
Nanoshield_ADC adc[4] = { 0x48, 0x49, 0x4A... |
4848dcbd-7203-4f01-8a43-e13aaff95bab | {
"language": "Arduino"
} | ```arduino
/*
MQTT subscriber example
- connects to an MQTT server
- subscribes to the topic "inTopic"
*/
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
const char *ssid = "xxxxxxxx"; // cannot be longer than 32 characters!
const char *pass = "yyyyyyyy"; //
// Update these with values suitable for your n... | ```arduino
/*
MQTT subscriber example
- connects to an MQTT server
- subscribes to the topic "inTopic"
*/
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
const char *ssid = "xxxxxxxx"; // cannot be longer than 32 characters!
const char *pass = "yyyyyyyy"; //
// Update these with values suitable for your n... |
0f219132-c9f9-4451-bb3c-d6c0f849ec37 | {
"language": "Arduino"
} | ```arduino
#define HALLPIN P1_5
int revs;
int count;
unsigned long oldtime;
unsigned long average;
int rpm[5];
int hallRead;
int switched;
void magnet_detect();
void setup()
{
Serial.begin(9600);
//Pull down to start
pinMode(HALLPIN,INPUT_PULLDOWN);
//initialize variables
switched = 0;
revs ... | ```arduino
#define HALLPIN P1_5
int revs;
unsigned long oldtime;
unsigned int average;
int rpm[5];
int hallRead;
int switched;
void setup()
{
Serial.begin(9600);
//Pull up to start
pinMode(HALLPIN,INPUT_PULLUP);
pinMode(P1_4,OUTPUT);
digitalWrite(P1_4,HIGH);
//initialize variables
switch... |
0b6b81e9-82c4-4dcb-a9b4-1b42625df8bf | {
"language": "Arduino"
} | ```arduino
#include <FastLED.h>
#include <Segment16.h>
Segment16 display;
void setup(){
Serial.begin(9600);
while (!Serial) {} // wait for Leonardo
Serial.println("Type any character to start");
while (Serial.read() <= 0) {}
delay(200); // Catch Due reset problem
// assume the user typed a valid charact... | ```arduino
#include <FastLED.h>
#include <Segment16.h>
Segment16 display;
uint32_t incomingByte = 0, input = 0; // for incoming serial data
void setup(){
Serial.begin(9600);
while (!Serial) {} // wait for Leonard
Serial.println("Type any character to start");
while (Serial.read() <= 0) {}
delay(200); //... |
dfaaa3dd-538a-4056-a8db-6ad1c9c1eecd | {
"language": "Arduino"
} | ```arduino
/**
* Read raw 20-bit integer value from a load cell using the ADS1230 IC in the LoadCell Nanoshield.
*
* Copyright (c) 2015 Circuitar
* This software is released under the MIT license. See the attached LICENSE file for details.
*/
#include <SPI.h>
#include <Nanoshield_LoadCell.h>
// LoadCell Nanoshiel... | ```arduino
/**
* Read raw 20-bit integer value from a load cell using the ADS1230 IC in the LoadCell Nanoshield.
*
* Copyright (c) 2015 Circuitar
* This software is released under the MIT license. See the attached LICENSE file for details.
*/
#include <SPI.h>
#include <Nanoshield_LoadCell.h>
// LoadCell Nanoshiel... |
85f5247b-6fe1-46fc-a931-56846a863081 | {
"language": "Arduino"
} | ```arduino
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
```
Add code for blinking LED on digital out 13 | ```arduino
/*
Turns on an LED for one seconds, then off for one second, repeat.
This example is adapted from Examples > 01.Basics > Blink
*/
// On the Arduino UNO the onboard LED is attached to digital pin 13
#define LED 13
void setup() {
// put your setup code here, to run once:
pinMode(LED, OUTPUT);
}
... |
94b59854-87d7-40d6-bead-92dce34dd4ff | {
"language": "Arduino"
} | ```arduino
#include <NewPing.h>
#include <Sonar.h>
#include <Tach.h>
#define SENSOR_SONAR 14
#define SENSOR_TACH_0 2
#define SENSOR_TACH_1 3
#define MAX_DISTANCE 300
#define LED13 13
#define FREQ 20
void tach_0_dispatcher();
void tach_1_dispatcher();
Sonar sonar(SENSOR_SONAR, MAX_DISTANCE);
Tach tach_0(SENSOR_TACH_0... | ```arduino
#include <NewPing.h>
#include <Sonar.h>
#include <Tach.h>
#define SENSOR_SONAR 14
#define SENSOR_TACH_0 2
#define SENSOR_TACH_1 3
#define MAX_DISTANCE 300
#define LED13 13
#define FREQ 20
void tach_0_dispatcher();
void tach_1_dispatcher();
Sonar sonar(SENSOR_SONAR, MAX_DISTANCE);
Tach tach_0(SENSOR_TACH_0... |
b8cdd9ab-c950-4b9c-bffa-c03c0d345506 | {
"language": "Arduino"
} | ```arduino
/*
Test SD Card Shield sensor with Low Power library sleep
This sketch specifically tests the DeadOn RTC - DS3234 Breakout board
used on our sensor platform.
This sketch will write a value of n + 1 to the file test.txt when
the RocketScream wakes up.
You should detach the RTC breakout board an... | ```arduino
/*
Test SD Card Shield sensor with Low Power library sleep
This sketch specifically tests the DeadOn RTC - DS3234 Breakout board
used on our sensor platform.
This sketch will write a value of n + 1 to the file test.txt each time
the RocketScream wakes up.
You should detach the RTC breakout boa... |
b02f193a-f532-453b-89c7-d7e16975eed2 | {
"language": "Arduino"
} | ```arduino
#include "serLCD.h"
#define LCD_PIN 2
#define LED_PIN 13
#define BLINK_DELAY 75
/*serLCD lcd(LCD_PIN);*/
void setup() {
delay(2000);
Serial.begin(9600);
Serial.println("hello world");
for (int i = 0; i < 4; i++) {
blink();
}
delay(1000);
}
String str = "";
char character;
void loop() ... | ```arduino
#include "serLCD.h"
#define LCD_PIN 5
#define LED_PIN 13
#define BLINK_DELAY 75
serLCD lcd(LCD_PIN);
void setup() {
delay(2000);
Serial.begin(9600);
Serial.println("hello world");
for (int i = 0; i < 4; i++) {
blink();
}
delay(1000);
}
String str = "";
char character;
void loop() {
... |
dd7d6533-7465-450d-bc03-19aecdd167fa | {
"language": "Arduino"
} | ```arduino
/*
Controlling a servo position using a potentiometer (variable resistor)
by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
modified on 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Knob
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo... | ```arduino
/*
Controlling a servo position using a potentiometer (variable resistor)
by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
modified on 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Knob
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
i... |
342b2ec8-5d31-4c4a-a91f-d0949e9b0228 | {
"language": "Arduino"
} | ```arduino
#define LED GREEN_LED
void setupBlueLed() {
// initialize the digital pin as an output.
pinMode(LED, OUTPUT);
}
// the loop routine runs over and over again forever as a task.
void loopBlueLed() {
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(5... | ```arduino
#define LED GREEN_LED
void setupGreenLed() {
// initialize the digital pin as an output.
pinMode(LED, OUTPUT);
}
// the loop routine runs over and over again forever as a task.
void loopGreenLed() {
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay... |
4ac12e7c-337e-487b-b4b5-91b0908b92a2 | {
"language": "Arduino"
} | ```arduino
const int BUTTON_PIN = 12;
const int LED_PIN = 13;
// See https://www.arduino.cc/en/Tutorial/StateChangeDetection
void setup() {
// Initialize the button pin as a input.
pinMode(BUTTON_PIN, INPUT);
// initialize the LED as an output.
pinMode(LED_PIN, OUTPUT);
// Initialize serial communication fo... | ```arduino
const int BUTTON_PIN = 12;
const int LED_PIN = 13;
const int PIEZO_PIN = 8;
// See https://www.arduino.cc/en/Tutorial/StateChangeDetection
void setup() {
// Initialize the button pin as a input.
pinMode(BUTTON_PIN, INPUT);
// initialize the LED as an output.
pinMode(LED_PIN, OUTPUT);
// Initializ... |
69ab2f5a-283a-49c5-ad35-ff862133d6d1 | {
"language": "Arduino"
} | ```arduino
#include "neopixel/neopixel.h"
#include "RandomPixels.h"
#define PIN 6
Adafruit_NeoPixel snowStrip1 = Adafruit_NeoPixel(24, PIN, WS2812);
RandomPixels snowRing1 = RandomPixels();
void setup() {
snowStrip1.begin();
snowStrip1.show();
randomSeed(analogRead(0));
}
void loop() {
snowRi... | ```arduino
#include "neopixel/neopixel.h"
#include "RandomPixels.h"
Adafruit_NeoPixel neopixelRingLarge = Adafruit_NeoPixel(24, 6, WS2812);
RandomPixels ringLarge = RandomPixels();
Adafruit_NeoPixel neopixelRingMedium = Adafruit_NeoPixel(16, 7, WS2812);
RandomPixels ringMedium = RandomPixels();
Adafruit_NeoPixel ne... |
aaed6260-0dce-4056-88fe-0f37952670f7 | {
"language": "Arduino"
} | ```arduino
#include <RunningAverage.h>
#include <HX711.h>
#define DISP_TIMER_CLK 12
#define DISP_TIMER_DIO 11
#define DISP_SCALE_CLK 3
#define DISP_SCALE_DIO 2
#define SCALE_DT A1
#define SCALE_SCK A2
#include "TimerDisplay.h"
#include "GramsDisplay.h"
#define FILTER_SIZE 10
#define SCALE_FACTOR 1876
#de... | ```arduino
#include <RunningAverage.h>
#include <HX711.h>
#include "TimerDisplay.h"
#include "GramsDisplay.h"
#define DISP_TIMER_CLK 2
#define DISP_TIMER_DIO 3
#define DISP_SCALE_CLK 8
#define DISP_SCALE_DIO 9
#define SCALE_DT A2
#define SCALE_SCK A1
#define FILTER_SIZE 10
#define SCALE_FACTOR 1874
#defi... |
fd21b1ac-6f7c-48a9-9bf4-45764717db55 | {
"language": "Arduino"
} | ```arduino
#define thresh 600 // If our analogRead is less than this we will blink
void setup() {
pinMode(13,OUTPUT); // On board LED in Arduino Micro is 13
}
void loop() {
int sensorValue = analogRead(A0); // read the voltage from the sensor on A0
Serial.println(sensorValue,DEC); // print the value
digitalW... | ```arduino
#define thresh 600 // If our analogRead is less than this we will blink
void setup() {
pinMode(LED_BUILTIN,OUTPUT); // On board LED in Arduino Micro is 13
}
void loop() {
int sensorValue = analogRead(A0); // read the voltage from the sensor on A0
Serial.println(sensorValue,DEC); // print the value
... |
4f9381b8-709e-4f03-b228-ede36aeacc1b | {
"language": "Arduino"
} | ```arduino
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define NUM_LEDS 300
#define PIN 7
#define WHITE 255,255,255
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
int lighting_style = 0;
int intensity = 0;
uint8_t index = 0;
void setup() {
Ser... | ```arduino
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define NUM_LEDS 300
#define PIN 7
#define WHITE 255,255,255
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
uint8_t intensity = 0;
uint8_t index = 0;
void setup() {
Serial.begin(9600);
... |
32d13407-8842-42fe-857c-b234ff250481 | {
"language": "Arduino"
} | ```arduino
#include <pins.h>
#include <radio.h>
#include <motor.h>
#include <encoder.h>
#include <control.h>
void setup(void) {
Serial.begin(115200);
Radio::Setup();
Motor::Setup();
Encoder::Setup();
Control::acc = 0;
}
void loop(){
Control::stand();
}
```
Facilitate how to define which robot is being... | ```arduino
#define robot_number 1 //Define qual robô esta sendo configurado
#include <pins.h>
#include <radio.h>
#include <motor.h>
#include <encoder.h>
#include <control.h>
void setup(void) {
Serial.begin(115200);
Radio::Setup();
Motor::Setup();
Encoder::Setup();
Control::acc = 0;
}
void loop(){
Contr... |
855d109a-7193-49da-8f65-0f267f996752 | {
"language": "Arduino"
} | ```arduino
void setup() {
// put your setup code here, to run once:
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(13, OUTPUT);
}
void loop() {
int len = 500;
int t1 = 220;
int t2 = 246.94;
int t3 = 277.18;
int t4 = 293.66;
int ... | ```arduino
void setup() {
// put your setup code here, to run once:
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(13, OUTPUT);
}
void loop() {
int len = 500;
float t1 = 220;
float t2 = 246.94;
float t3 = 277.18;
float t4 = 293.66... |
c09266d6-774a-4c35-9c39-50d9754477e2 | {
"language": "Arduino"
} | ```arduino
// RFID_UART.ino
#if defined (SPARK)
#include "SeeedRFID/SeeedRFID.h"
#else
#include <SoftwareSerial.h>
#include <SeeedRFID.h>
#endif
#define RFID_RX_PIN 10
#define RFID_TX_PIN 11
// #define DEBUGRFID
#define TEST
SeeedRFID RFID(RFID_RX_PIN, RFID_TX_PIN);
RFIDdata tag;
void setup() {
Serial1.begin(9600... | ```arduino
// RFID_UART.ino
#if defined (PLATFORM_ID)
#include "SeeedRFID/SeeedRFID.h"
#else
#include <SoftwareSerial.h>
#include <SeeedRFID.h>
#endif
#define RFID_RX_PIN 10
#define RFID_TX_PIN 11
// #define DEBUGRFID
#define TEST
SeeedRFID RFID(RFID_RX_PIN, RFID_TX_PIN);
RFIDdata tag;
void setup() {
Serial1.begi... |
a52cb78d-4489-406f-8ad2-f7d4ea5c8cfd | {
"language": "Arduino"
} | ```arduino
#include <Homie.h>
const int TEMPERATURE_INTERVAL = 300;
unsigned long lastTemperatureSent = 0;
HomieNode temperatureNode("temperature", "temperature");
void setupHandler() {
Homie.setNodeProperty(temperatureNode, "unit", "c", true);
}
void loopHandler() {
if (millis() - lastTemperatureSent >= TEMPE... | ```arduino
#include <Homie.h>
const int TEMPERATURE_INTERVAL = 300;
unsigned long lastTemperatureSent = 0;
HomieNode temperatureNode("temperature", "temperature");
void setupHandler() {
Homie.setNodeProperty(temperatureNode, "unit", "c", true);
}
void loopHandler() {
if (millis() - lastTemperatureSent >= TEMPE... |
2c387ef5-e40e-4613-ac43-56471fcc3255 | {
"language": "Arduino"
} | ```arduino
#include "brotherKH930.h"
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
```
Add main to test the position logic. | ```arduino
#include "brotherKH930.h"
PinSetup pins = kniticV2Pins();
BrotherKH930 brother(pins);
void setup() {
Serial.begin(115200);
Serial.println("Ready.");
}
void loop() {
Direction dir = brother.direction();
int pos = brother.position();
Serial.print("@");
Serial.print(pos);
Serial.print(" ");
... |
1351cd44-4580-45ae-a1b3-0cf0d53f59ee | {
"language": "Arduino"
} | ```arduino
#include <Arduino.h>
#include "test_cpp_wrapper.h"
void
setup(
)
{
Serial.begin(BAUD_RATE);
runalltests_cpp_wrapper();
}
void
loop(
)
{
}```
Fix missing SD begin in C++ Wrapper test | ```arduino
#include <Arduino.h>
#include <SPI.h>
#include <SD.h>
#include "test_cpp_wrapper.h"
void
setup(
)
{
SPI.begin();
SD.begin(SD_CS_PIN);
Serial.begin(BAUD_RATE);
runalltests_cpp_wrapper();
}
void
loop(
)
{
}``` |
d7321a55-de80-4793-9db5-49b40aba0b34 | {
"language": "Arduino"
} | ```arduino
/*
btnLed sketch
Push a button to turn on a LED.
Push the button again to turn the LED off.
*******
Do not connect more than 5 volts directly to an Arduino pin!!
*******
*/
#define pushbuttonPIN 2
#define onoffPIN 3
volatile int flag = LOW;
unsigned long timestamp = 0;
void setup()
{
pinMod... | ```arduino
/*
btnLed sketch
Push a button to turn on a LED.
Push the button again to turn the LED off.
*******
Do not connect more than 5 volts directly to an Arduino pin!!
*******
*/
#define pushbuttonPIN 2
#define onoffLED 3
volatile int flag = LOW;
unsigned long timestamp = 0;
void setup()
{
pinMod... |
b75ec0e7-0668-4231-8de8-b92697517c6b | {
"language": "Arduino"
} | ```arduino
/*
ArcFour Entropy Seeding Demo
created 10 Jun 2014
by Pascal de Bruijn
*/
#include <Entropy.h>
#include <ArcFour.h>
ArcFour ArcFour;
int ledPin = 13;
void setup()
{
Serial.begin(9600);
while (!Serial)
{
; // wait for serial port to connect. Needed for Leonardo and Due
}
Ent... | ```arduino
/*
ArcFour Entropy Seeding Demo
created 10 Jun 2014
by Pascal de Bruijn
*/
#include <Entropy.h>
#include <ArcFour.h>
ArcFour ArcFour;
int ledPin = 13;
void setup()
{
Serial.begin(9600);
while (!Serial)
{
; // wait for serial port to connect. Needed for Leonardo and Due
}
Ent... |
a0f867c0-8585-4e5d-9075-170b258d2e38 | {
"language": "Arduino"
} | ```arduino
// This program allows the Spark to act as a relay
// between a terminal program on a PC and the
// Fingerprint sensor connected to RX/TX (Serial1)
// on the Spark
void setup() {
// initialize both serial ports:
Serial.begin(57600);
Serial1.begin(57600);
}
void loop() {
// read from Serial1 (Finger... | ```arduino
// This program allows the Spark to act as a relay
// between a terminal program on a PC and the
// Fingerprint sensor connected to RX/TX (Serial1)
// on the Spark
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(57600);
Serial1.begin(57600);
}
void loop() // ru... |
f88aa3a6-4271-4a05-9f3a-d9bbee984294 | {
"language": "Arduino"
} | ```arduino
#include "CurieImu.h"
int16_t ax, ay, az;
void setup() {
Serial.begin(9600);
while (!Serial);
CurieImu.initialize();
if (!CurieImu.testConnection()) {
Serial.println("CurieImu connection failed");
}
CurieImu.setFullScaleAccelRange(BMI160_ACCEL_RANGE_8G);
}
void loop() {
CurieImu.getAc... | ```arduino
#include "CurieIMU.h"
int ax, ay, az;
void setup() {
Serial.begin(9600);
while (!Serial);
CurieIMU.begin();
if (!CurieIMU.testConnection()) {
Serial.println("CurieImu connection failed");
}
CurieIMU.setAccelerometerRange(8);
}
void loop() {
CurieIMU.readAccelerometer(ax, ay, az);
Se... |
a5fa4489-0f15-4ac5-ad52-2c21a885273a | {
"language": "Arduino"
} | ```arduino
#include <Arduino.h>
#include "config.h"
#include <DcMotor.h>
DcMotor xMotor(X_AXIS_PWM, X_AXIS_FWD, X_AXIS_REV),
yMotor(Y_AXIS_PWM, Y_AXIS_FWD, Y_AXIS_REV),
zMotor(Z_AXIS_PWM, Z_AXIS_FWD, Z_AXIS_REV);
void setup() {
Serial.begin(BAUDRATE);
xMotor.begin();
yMotor.begin();
zMotor.begin();
}
v... | ```arduino
#include <Arduino.h>
#include "config.h"
#include <DcMotor.h>
DcMotor xMotor(X_AXIS_PWM, X_AXIS_FWD, X_AXIS_REV);
DcMotor yMotor(Y_AXIS_PWM, Y_AXIS_FWD, Y_AXIS_REV);
DcMotor zMotor(Z_AXIS_PWM, Z_AXIS_FWD, Z_AXIS_REV);
void setup() {
Serial.begin(BAUDRATE);
xMotor.begin();
yMotor.begin();
zMotor.be... |
a29b351b-2c25-4242-ae97-916b6f6eedb8 | {
"language": "Arduino"
} | ```arduino
// RFID_UART.ino
#if defined (SPARK)
#include "SeeedRFID/SeeedRFID.h"
#else
#include <SoftwareSerial.h>
#include <SeeedRFID.h>
#endif
#define RFID_RX_PIN 10
#define RFID_TX_PIN 11
// #define DEBUG
#define TEST
SeeedRFID RFID(RFID_RX_PIN, RFID_TX_PIN);
RFIDdata tag;
void setup() {
Serial.begin(57600);
... | ```arduino
// RFID_UART.ino
#if defined (SPARK)
#include "SeeedRFID/SeeedRFID.h"
#else
#include <SoftwareSerial.h>
#include <SeeedRFID.h>
#endif
#define RFID_RX_PIN 10
#define RFID_TX_PIN 11
// #define DEBUG
#define TEST
SeeedRFID RFID(RFID_RX_PIN, RFID_TX_PIN);
RFIDdata tag;
void setup() {
Serial1.begin(9600); /... |
4fc89a9b-5cec-4864-b355-a7a84ce49d3b | {
"language": "Arduino"
} | ```arduino
#include <Smartcar.h>
const int TRIGGER_PIN = 6; //D6
const int ECHO_PIN = 7; //D7
SR04 front(TRIGGER_PIN, ECHO_PIN, 10);
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(front.getDistance());
delay(100);
}
```
Adjust max sensor distance to something more suitable | ```arduino
#include <Smartcar.h>
const int TRIGGER_PIN = 6; //D6
const int ECHO_PIN = 7; //D7
const unsigned int MAX_DISTANCE = 100;
SR04 front(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(front.getDistance());
delay(100);
}
``` |
7574bd02-da60-4e64-a9e0-64752e985bc9 | {
"language": "Arduino"
} | ```arduino
#include <SoftwareSerial.h>
// Serial speed
#define SERIAL_BAUDRATE 9600
#define LIGHTSENSOR_PIN 3
#define FETCH_INTERVAL 100
#define POST_INTERVAL 5000
const int numLedSamples = POST_INTERVAL / FETCH_INTERVAL;
int ledSamples[numLedSamples];
int ledSampleCounter = 0;
int light = 0;
// Software serial fo... | ```arduino
#include <SoftwareSerial.h>
// Serial speed
#define SERIAL_BAUDRATE 9600
#define LIGHTSENSOR_PIN 3
#define FETCH_INTERVAL 100
#define POST_INTERVAL 5000
const int numLedSamples = POST_INTERVAL / FETCH_INTERVAL;
int ledSamples[numLedSamples];
int ledSampleCounter = 0;
int light = 0;
// Software serial fo... |
80b85718-eda9-4126-afae-b1741b9cc637 | {
"language": "Arduino"
} | ```arduino
```
Add main MIDI controller sketch | ```arduino
#include <MIDI.h>
#define PIN_KEY_IN 2
#define PIN_MIDI_OUT 3
MIDI_CREATE_DEFAULT_INSTANCE();
void setup()
{
pinMode(PIN_KEY_IN, INPUT);
pinMode(PIN_MIDI_OUT, OUTPUT);
MIDI.begin();
}
void loop()
{
// Read digital value from piano key
int in_value = digitalRead(PIN_KEY_IN);
... |
ba2fc078-9a11-4bdb-9b27-e1f9cf28a299 | {
"language": "Arduino"
} | ```arduino
```
Add example with no devices | ```arduino
/******************************************************************
Example starting point sketch for ParticleIoT library
This example contains no devices.
It is provided for comparison with other example sketches.
http://www.github.com/rlisle/ParticleIoT
Written by Ron Lisle
BSD license, check LICENSE f... |
c8e1d817-b952-41c4-815b-1bd72e471607 | {
"language": "Arduino"
} | ```arduino
```
Add a sort of intensity wave option | ```arduino
#include <G35String.h>
//#define TWO_STRINGS
#ifdef TWO_STRINGS
#define LIGHT_COUNT 50
#define G35_PIN1 9
#define G35_PIN2 10
G35String lights1(G35_PIN1, LIGHT_COUNT);
G35String lights2(G35_PIN2, LIGHT_COUNT);
const int middle = 0;
#else
#define LIGHT_COUNT 49
#define G35_PIN 9
G35String... |
c68ef062-4ee8-41b1-9339-26e05edcb084 | {
"language": "Arduino"
} | ```arduino
```
Add v0.2.0 conditioning Arduino source | ```arduino
#include "AES.h"
#include "CBC.h"
#define CHAIN_SIZE 2
#define BLOCK_SIZE 16
#define SAMPLE_SIZE (BLOCK_SIZE * CHAIN_SIZE)
byte key[16] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
CBC<AES128> cbc;
byte sourcePool[SAMPLE_SIZE];
... |
9287f07f-0136-4bd2-b43e-67550200a76b | {
"language": "Arduino"
} | ```arduino
```
Add boilerplate .ino to implement the baro sensor | ```arduino
#include <Wire.h>
#include <Adafruit_BMP085.h>
/***************************************************
This is an example for the BMP085 Barometric Pressure & Temp Sensor
Designed specifically to work with the Adafruit BMP085 Breakout
----> https://www.adafruit.com/products/391
These displays use I... |
c0a0756a-4544-46c8-aa57-85b6de4c37ba | {
"language": "Arduino"
} | ```arduino
```
Add sample for simple bluetooth data. | ```arduino
#include <Arduino.h>
#include <SPI.h>
#if not defined (_VARIANT_ARDUINO_DUE_X_) && not defined (_VARIANT_ARDUINO_ZERO_)
#include <SoftwareSerial.h>
#endif
#include "Adafruit_BLE.h"
#include "Adafruit_BluefruitLE_SPI.h"
#include "Adafruit_BluefruitLE_UART.h"
#include "BluefruitConfig.h"
static const int ... |
d0a46676-3723-4578-a2c7-7911dd4f04ba | {
"language": "Arduino"
} | ```arduino
```
Add arduino code to run interface to robot. | ```arduino
#include <Servo.h>
int fricken_laser = 7;
Servo s1;
Servo s2;
// for printf
int my_putc(char c, FILE *t)
{
Serial.write(c);
}
void setup()
{
fdevopen(&my_putc, 0);
Serial.begin(57600);
Serial.setTimeout(1000);
s2.attach(3);
s1.attach(9);
pinMode(fricken_laser, OUTPUT);
}
vo... |
014107c5-d2b8-43c3-8cd9-de36c8084f4a | {
"language": "Arduino"
} | ```arduino
```
Add CC3000 Firmware update Sketch | ```arduino
/*
This Sketch will update the firmware of the CC3000 to
a version that works with this library.
The fimware update takes about 10. If the upgrade is successfull
the RED and GREEN LEDs will flash.
Circuit:
* WiFi BoosterPack
Created: October 24, 2013 by Robert Wessels (http://energia.nu)
*/
#i... |
daec62a9-3e44-4e38-ad5c-98a17ae7504a | {
"language": "Arduino"
} | ```arduino
```
Add test sketch (to be removed). | ```arduino
#include <Bridge.h>
#include <BridgeClient.h>
#include "Arduino-Websocket/WebSocketClient.h"
#include "vor_utils.h"
#include "vor_env.h"
#include "vor_led.h"
#include "vor_motion.h"
#include "vor_methane.h"
#define MAX_ATTEMPTS 10
#define INTERVAL 30000
#define HEARTBEAT_INTERVAL 25000
#define MOTION_PIN... |
0fd4695e-31db-4235-aa0a-177fc3198ecc | {
"language": "Arduino"
} | ```arduino
```
Backup of Working Slave Code | ```arduino
/*
* Temperature Sensor Displayed on 4 Digit 7 segment common anode
* Created by Rui Santos, http://randomnerdtutorials.com
*/
const int digitPins[4] = {
4,5,6,7}; //4 common anode pins of the display
const int clockPin = 11; //74HC595 Pin 11
const int latchPin = 12; //74HC595 Pin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.