Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Change to use automatic gain. | // 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 means an 8 po... | // 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 means an 8 po... |
Update SR04 example to new 5.0 API | #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);
}
| #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);
}
|
Change baud rate to 9600. | 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(ypin, INPUT);... | 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, INPUT);
... |
Implement custom BMP data structure in program | #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
namespace... | #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 file; // file... |
Fix order of Serial.println arguments for HEX printing | #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);
// initialize s... | #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);
// initialize s... |
Update class name. ToDo: search slave address. | //
// 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:");
Seria... | //
// 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.readData();
... |
Fix typo in string termination | /*
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 communications and wai... | /*
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 communications and wai... |
Update delay time for arduino button read | 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);
}
| 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 = digitalRead(bu... |
Add sendData func and diagonalLines test pattern | //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() {
// count from 2 (0... | //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 = 0; i < b... |
Change the trigger frequency to 9Hz. |
//
// 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-Output signa... |
//
// 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, INPUT );
pin... |
Fix DEBUG compile flag issue | // 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); //Done here ... | // 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); //Done h... |
Fix text shown on serial monitor. | /**
* 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, 0x4B };
... | /**
* 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, 0x4B };
... |
Fix signature of callback function in subscriber example | /*
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 network.
IPA... | /*
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 network.
IPA... |
Update hallsensor code to reflect changes in wiring on breadboard using pullup resistor | #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 = 0;
ol... | #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
switched = 0;
... |
Add ability to input alt characters | #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 character and no r... | #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); // Catch Due ... |
Fix raw value output to serial terminal. | /**
* 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 Nanoshield with the ... | /**
* 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 Nanoshield with the ... |
Add code for blinking LED on digital out 13 | void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
| /*
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);
}
void loop()... |
Use the sensor id as the identifier. | #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, tach_0_di... | #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, tach_0_di... |
Remove blink code since unused here | /*
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 and GSM Shiel... | /*
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 board and GSM ... |
Set up the LCD pin | #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() {
ledOff(... | #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() {
ledOff();
... |
Modify pin 19's pin description for EVT board | /*
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
int potpi... | /*
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
int potpin =... |
Correct typo in setup/loop tuple | #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(500); ... | #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(500); ... |
Add sound when button is held down | 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 for debugging... | 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);
// Initialize serial co... |
Work on snow animation for three rings of tree | #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() {
snowRing1.Animate... | #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 neopixelRingS... |
Update pin numbers and load cell params | #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
#define SCALE_... | #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
#define SCALE_OF... |
Tweak to code so it will use the builtin LED on any board | #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
digitalWrite(13,sen... | #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
digitalWri... |
Update arduino code to light 3 pixels at a time. | #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() {
Serial.begin(9... | #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);
strip.begi... |
Facilitate how to define which robot is being configured, on .ino now. | #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();
}
| #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(){
Control::stand()... |
Change t* vars from ints to floats | 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 t5 = 329.63... | 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;
float t... |
Change to include Redbear Duo | // 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); //Done h... | // 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.begin(9600); //... |
Update temperature example with more semantic topic | #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 >= TEMPERATURE_INTE... | #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 >= TEMPERATURE_INTE... |
Add main to test the position logic. | #include "brotherKH930.h"
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
| #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(" ");
if (dir ==... |
Fix missing SD begin in C++ Wrapper test | #include <Arduino.h>
#include "test_cpp_wrapper.h"
void
setup(
)
{
Serial.begin(BAUD_RATE);
runalltests_cpp_wrapper();
}
void
loop(
)
{
} | #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(
)
{
} |
Use LED iso PIN to avoid confusion | /*
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()
{
pinMode(onoffPIN,... | /*
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()
{
pinMode(onoffLED,... |
Update for new Entropy API | /*
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
}
Entropy.Initia... | /*
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
}
Entropy.initia... |
Update to tested and working code | // 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 (Fingerprint reade... | // 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() // run over and ... |
Use Arduino101 CurieIMU new APIs. | #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.getAcceleration(... | #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);
Serial.print(... |
Split motor definitions into multiple lines | #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();
}
void loop() ... | #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.begin();
}
v... |
Update for Particle Core and Photon | // 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);
Serial.prin... | // 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); //Done here ... |
Adjust max sensor distance to something more suitable | #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);
}
| #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);
}
|
Add main MIDI controller sketch | #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);
// Ou... | |
Add a sort of intensity wave option |
#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 lights(G35... | |
Add v0.2.0 conditioning Arduino source | #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];
void setup... | |
Add boilerplate .ino to implement the baro sensor | #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 I2C to commu... | |
Add sample for simple bluetooth data. | #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 PIN = 5;
A... | |
Add arduino code to run interface to robot. | #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);
}
void loop()
{... | |
Add CC3000 Firmware update Sketch | /*
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)
*/
#include <SPI... | |
Add test sketch (to be removed). | #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 2
#define ... | |
Backup of Working Slave Code | /*
* 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 12
const i... | |
Add example to list all addresses where a device is present. | #include <SoftWire.h>
#include <AsyncDelay.h>
SoftWire sw(SDA, SCL);
void setup(void)
{
Serial.begin(9600);
sw.setTimeout_ms(40);
sw.begin();
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
// Set how long we are willing to wait for a device to respond
sw.setTimeout_ms(200);
const uin... | |
Add new starting payload program | #include <Wire.h>
#include "Adafruit_BMP085.h"
/*
* BMP180 setup instructions:
* ----------------------------------------
* Connect BMP180 V-in to 3.3V (NOT 5.0V)
* Connect BMP180 GND to Ground
* Connect BMP180 SCL to Analog 5
* Connect BMP180 SDA to Analog 4
* --------------------------------------... | |
Add HTTP POST for Arduino Yun. | /*
Yún HTTP Client
This example for the Arduino Yún shows how create a basic
HTTP client that connects to the internet and downloads
content. In this case, you'll connect to the Arduino
website and download a version of the logo as ASCII text.
created by Tom igoe
May 2013
This example code is in the public ... | |
Add the Arduino sketch for reading and remembering key numbers. Doesn't build with ino atm. | #include <OneWire.h>
#include <EEPROM.h>
// This is the pin with the 1-Wire bus on it
OneWire ds(PIN_D0);
// unique serial number read from the key
byte addr[8];
// poll delay (I think 750ms is a magic number for iButton)
int del = 1000;
// Teensy 2.0 has an LED on port 11
int ledpin = 11;
// number of values stor... | |
Test program for PIR module |
/****************************************************************************
PIRsensor : test program for PIR sensor module
Author: Enrico Formenti
Permissions: MIT licence
Remarks:
- OUT pin is connected to digital pin 2 of Arduino, change this if needed
- DELAY times depend on the type of m... | |
Add arduino code to work with the serial_test | /***************************************************
Simple serial server
****************************************************/
//serial
String inputString = ""; // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete
void setup(){
//delay(100); //wait for bus ... | |
Add next Arduino example - blinky with Timer1 OVF. | /**
* Copyright (c) 2019, Łukasz Marcin Podkalicki <lpodkalicki@gmail.com>
* ArduinoUno/001
* Blinky with timer1 OVF.
*/
#define LED_PIN (13)
#define TIMER_TCNT (57723) // 65536 - 16MHz/1024/2
void setup() {
pinMode(LED_PIN, OUTPUT); // set LED pin as output
TCCR1A = 0;
TCCR1B = _BV(CS12)|_BV(CS10); //... | |
Add basic GA1A12S202 light sensor Arduino testbed. | """
@author: Sze 'Ron' Chau
@source: https://github.com/wodiesan/senior_design_spring
@Desc: Adafruit Analog Light Sensor, modified by Ron Chau.
1. Connect sensor output to Analog Pin 0
2. Connect 5v to VCC and GND to GND
3. Connect 3.3v to the AREF pin
"""
int led1 = 2; // LED connected t... | |
Print all virtual data example | /**************************************************************
* 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, docs, tuto... | |
Add tests for web client | // Demo using DHCP and DNS to perform a web client request.
// 2011-06-08 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
#include <EtherCard.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[600];
static uint... | |
Add example of setbaud and findbaud | /*
* findBaudTest - Test all supported baud settings
*
* The progress and results are printed to Serial, so open the 'Serial
* Montitor'.
*
* The progress and results will be easier to read if you disable the
* debugging (comment out or delete the "#define DEBUG_HC05" line in
* HC05.h.
*/
#include <Arduino.h>
... | |
Add simple program that sets the first recived byte by BLE and write in the pot | /*
Digital Potentiometer control over BLE
MCP4110 digital Pots SPI interface
*/
// inslude the SPI library:
#include <SPI.h>
#include <SoftwareSerial.h>
SoftwareSerial bleSerial(2, 3); // RX, TX
// set pot select pin
const int potSS = 10;
//const int potWriteCmd = B00100011;
const int potWriteCmd = B0001001... | |
Add GSM Serial for testing AT Command | #include <SoftwareSerial.h>
SoftwareSerial SSerial(10, 11);
void setup(void) {
Serial.begin(9600);
SSerial.begin(9600);
}
void loop(void) {
if (Serial.available() > 0) {
SSerial.write(Serial.read());
}
if (SSerial.available() > 0) {
Serial.write(SSerial.read());
}
}
| |
Add sketch to verify Watchdog/RTC::since() behavior. | /**
* @file CosaSince.ino
* @version 1.0
*
* @section License
* Copyright (C) 2015, Mikael Patel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the Li... | |
Add example of Iot device that posts to data.sparkfun.com | #include "DHT.h"
#define DHTPIN 2 // what pin we're connected to
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with... | |
Test input values by displaying in the serial monitor | //Skript for testing the input-values of the arduino by displaying values in the serial monitor
int delayTime = 4000;
int buttonState = 0;
int piezo = A0;
int photo = A1;
int poti = A2;
int switchBtn = 11;
int buttonBtn = 12;
int extFlash = 8;
int camTrigger = 9;
int camFocus = 10;
int pi... | |
Add a DMX send example | #include <TeensyDmx.h>
#define DMX_REDE 2
byte DMXVal[] = {50};
// This isn't required for DMX sending, but the code currently requires it.
struct RDMINIT rdmData {
"TeensyDMX v0.1",
"Teensyduino",
1, // Device ID
"DMX Node",
1, // The DMX footprint
0, // The DMX startAddress - only used for RDM
0, ... | |
Add draw text with scale example. | #include "AL_ILI9341.h"
#include "AL_Font.h"
// Wiring
#define TFT_PORT PORTF
#define TFT_PIN PINF
#define TFT_DDR DDRF
#define TFT_RST A12
#define TFT_CS A11
#define TFT_RS A10
#define TFT_WR A9
#define TFT_RD A8
AL_ILI9341 tft(
&TFT_PORT, &TFT_PIN, &TFT_DDR,
TFT_RST, TFT_CS, TFT_RS, TFT_WR, T... | |
Add test sketch for SR-04 ultasound sensors |
#include <NewPing.h>
#define SONAR_NUM 4 // Number or sensors.
#define MAX_DISTANCE 200 // Maximum distance (in cm) to ping.
#define PING_INTERVAL 33 // Milliseconds between sensor pings (29ms is about the min to avoid cross-sensor echo).
unsigned long pingTimer[SONAR_NUM]; // Holds the times when the next ping shou... | |
Add Arduino sketch for testing individual strips | // Program for testing a single strip of lights.
// Cycles through each possible combination of pure colors:
// #000000 #FF0000 #00FF00 #FFFF00 #0000FF #FF00FF #00FFFF #FFFFFF
// For each color, lights up lights one at a time with a slight delay between
// individual lights, then leaves the whole strip lit up for 2 sec... | |
Add the arduino sketch to test the rover movement. | /*
* Author: Manuel Parra Z.
* Date: 14/11/2015
* License: MIT License
* Materials:
* - Arduino Uno R3
* - DFRobot DF-MD V1.3
* - DFRobot Pirate 4WD
* Description:
* This sketch will use as a movement test, first the rover will go foward
* on the track, then it will go reverse, then will turn ... | |
Add example for pairing with AccelStepper library | /**
* Author Teemu Mäntykallio
* Initializes the library and turns the motor in alternating directions.
*/
#define EN_PIN 38 // Nano v3: 16 Mega: 38 //enable (CFG6)
#define DIR_PIN 55 // 19 55 //direction
#define STEP_PIN 54 // 18 54 //step
#define CS_PIN 4... | |
Add RedBearLab BLE Mini module | /**************************************************************
* 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, docs, tuto... | |
Add WiFiNINA, Arduino MKR WiFi 1010 support | /*************************************************************
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 interfaces... | |
Add an example showing how to set the QoS value of a message to publish | /*
MQTT with QoS example
- connects to an MQTT server
- publishes "hello world" to the topic "outTopic" with a variety of QoS values
*/
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
const char *ssid = "xxxxxxxx"; // cannot be longer than 32 characters!
const char *pass = "yyyyyyyy"; //
// Update these ... | |
Add Arduino example that receives ESP predictions over serial. | // Arduino example that streams accelerometer data from an ADXL335
// (or other three-axis analog accelerometer) to the ESP system and
// lights different LEDs depending on the predictions made by the
// ESP system. Use with the user_accelerometer_gestures.cpp ESP example.
// the accelerometer pins
int zpin = A3;
int ... | |
Add demo on new functionality | /*
* IRremote: IRInvertModulate - demonstrates the ability enable/disable
* IR signal modulation and inversion.
* An IR LED must be connected to Arduino PWM pin 3.
* To view the results, attach an Oscilloscope or Signal Analyser across the
* legs of the IR LED.
* Version 0.1 November, 2013
* Copyright 2013 Aaron... | |
Bring up verification of GroveMoisture | int sensorPin = A1; // select the input pin for the potentiometer
float sensorValue[0];
float get_sensor_data_moisture(){
// read the value from the sensor:
return analogRead(sensorPin);
}
void setup() {
// declare the ledPin as an OUTPUT:
Serial.begin(115200);
}
void loop() {
sensorValue[0]=... | |
Add example sketch for testing out "will" messages | /*
MQTT "will" message example
- connects to an MQTT server with a will message
- publishes a message
- waits a little bit
- disconnects the socket *without* sending a disconnect packet
You should see the will message published when we disconnect
*/
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
cons... | |
Test code for the line follow | #define FAR_LEFT A0
#define LEFT A1
#define CENTER_LEFT A2
#define CENTER_RIGHT A3
#define RIGHT A4
#define FAR_RIGHT A5
#define WB_THRESHOLD 400
#define IR_DELAY 140
void setup()
{
Serial.begin(9600);
pinMode(FAR_LEFT, INPUT);
pinMode(LEFT, INPUT);
pinMode(CENTER_LEFT, INPUT);
pinMode(CENTER_RIGHT, INPUT... | |
Add blink file too for ease of access | /*
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 and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http:/... | |
Add arduino stepper motor control |
/*
Stepper Motor Control
*/
#include <Stepper.h>
const int stepsPerRevolution = 200; // 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 ste... | |
Add super simple arduino servo-based cutdown program. | #include <Servo.h>
Servo myservo;
int pos = 0;
void setup() {
myservo.attach(9);
myservo.write(45); // Start out in a good position
delay(5000); // Wait as long as you like. (milliseconds)
}
void loop() {
myservo.write(130) // End in a release position
while(true); // Do nothing, forever.
}
| |
Add simple Arduino test program | void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
Keyboard.begin();
//setup buttons
pinMode(2, INPUT_PULLUP); //Button 1
pinMode(3, INPUT_PULLUP); //Button 2
pinMode(4, INPUT_PULLUP); //Button 3
pinMode(5, INPUT_PULLUP); //Button 4
//setup mainboard connect... | |
Add a tool for auto calibration of watchdog based clock. | /**
* @file CosaAutoCalibration.ino
* @version 1.0
*
* @section License
* Copyright (C) 2015, Mikael Patel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1... | |
Add TFmini plus (lidar) test code | // set this to the hardware serial port you wish to use
#define HWSERIAL Serial1
byte byteArray [9];
// Byte0 Byte 1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte7 Byte8
// 0x89 0x89 Dist_L Dist_H Strength_L Strength_H Temp_L Temp_H Checksum
// byte2 is distance, overflows into byte3
byte configOutput [5] = {0x5A,... | |
Test for motor using enable pins and buttons operation. | #include <Stepper.h>
#define P1 P4_5
#define P2 P1_1
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 12,13,5,9);
short forward;
short backward;
void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
// Enable pin... | |
Add canbus FD send example | // demo: CAN-BUS Shield, send data
// loovee@seeed.cc
#include <SPI.h>
#include "mcp2518fd_can.h"
/*SAMD core*/
#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
#define SERIAL SerialUSB
#else
#define SERIAL Serial
#endif
#define CAN_2518FD
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is... | |
Add ECDSA test for Arduino | #include <uECC.h>
#include <j0g.h>
#include <js0n.h>
#include <lwm.h>
#include <bitlash.h>
#include <GS.h>
#include <SPI.h>
#include <Wire.h>
#include <Scout.h>
#include <Shell.h>
#include <uECC.h>
extern "C" {
static int RNG(uint8_t *p_dest, unsigned p_size)
{
while(p_size) {
long v = random();
unsi... | |
Add sketch for reading button press | int BUTTON_PIN = 2;
void setup() {
pinMode(BUTTON_PIN, INPUT);
Serial.begin(9600);
}
void loop() {
//Serial.println("Hello computer!");
//Serial.print("This line will mash together with the next.");
int buttonPressed = digitalRead(BUTTON_PIN);
if(buttonPressed == 1) {
Serial.println("I pressed the ... | |
Add sketch that includes all LCD interface implementations and adapters. | /**
* @file CosaLCDverify.ino
* @version 1.0
*
* @section License
* Copyright (C) 2015, Mikael Patel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of th... | |
Add firmware for LightBlueBean Token | // Token's firmware working copy
// Code based on RFDUINO hardware, uses C char arrays
#include <ArduinoJson.h>
//Test JSON strings
char OFF[]= "{\"device\":\"LED\",\"event\":\"off\"}";
char GREEN[] = "{\"device\":\"LED\",\"event\":\"on\",\"color\":\"green\"}";
char RED[] = "{\"device\":\"LED\",\"event\":\"on\",\"... | |
Add new sketch for ESP8266 | /*
* Blink for esp8266
*/
#define ESP8266_LED 2
void setup() {
// put your setup code here, to run once:
pinMode(ESP8266_LED, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(ESP8266_LED, HIGH);
delay(1000);
digitalWrite(ESP8266_LED, LOW);
delay(1000);
}
| |
Add example to help find suitable contrast value. | /** Contrast Helper
*
* Loops through a range of contrast values and prints each one.
*
* To set the contrast in your sketch, simply put lcd.setContrast(xx);
* after your lcd.begin().
*
* Experimentally determined, contrast values around 65-70 tend to
* work reasonably well on most displays. The b... | |
Add Arduino program to generate camera and light trigger. |
//
// Generate a 9Hz square signal to trigger camera and lightning
//
// Arduino setup
void setup()
{
// Output signal
pinMode( 13, OUTPUT );
}
// Main loop
void loop()
{
// High state (11ms)
digitalWrite( 13, HIGH );
delay( 11 );
// Low state (100ms)
digitalWrite( 13, LOW );
delay( 100 );
}
| |
Add test sketch which simply runs each motor separately, without input from Android | #include "DualVNH5019MotorShield.h"
DualVNH5019MotorShield md;
void stopIfFault()
{
if (md.getM1Fault())
{
Serial.println("M1 fault");
while(1);
}
if (md.getM2Fault())
{
Serial.println("M2 fault");
while(1);
}
}
void setup()
{
Serial.begin(19200);
Serial.println("Dual VNH5019 Motor... | |
Add source code for Jarbas | #include <ESP8266HTTPClient.h>
#include <ESP8266WiFiMulti.h>
#define RELAY D1
const int HTTPS_PORT = 443;
const char* WIFI = "WIFI";
const char* PASSWORD = "PASSWORD";
const char* HOST = "hooks.slack.com";
const char* URL = "URL";
String PAYLOAD = String("{\"text\": \"@here Café quentinho na cafeteira!\", \"link_... | |
Add simple sketch to test Ultrasonic sensor | /*
Test Ultrasonic sensor readings
Created 2 7 2014
Modified 2 7 2014
*/
// Ultrasonic sensor settings
const byte ULTRASONIC_PIN = A6;
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println(analogRead(ULTRASONIC_PIN));
delay(1000);
} | |
Add Simblee BLE example | /**************************************************************
* 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, docs, tuto... | |
Add example of a custom function in serial | #include "VdlkinoSerial.h"
VdlkinoSerial vdlkino(14, 6, &Serial);
uint16_t get_analog_byte(void *block) {
VdlkinoBlock *vblock = (VdlkinoBlock*) block;
return map(analogRead(vblock->pin), 0, 1023, 0, 255);
}
void setup() {
Serial.begin(9600);
vdlkino.operations[8] = &get_analog_byte;
}
void loop() {
vdlki... | |
Add a simple example sketch with many explanatory comments | /*
NeoPixel Ring simple sketch (c) 2013 Shae Erisson
released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
*/
#include <Adafruit_NeoPixel.h>
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
#include <avr/power.h>
#endif
// Which pin on the FLORA is connected to the NeoPixel ring?
#define... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.