This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This sketch is based on Tom Igoe's modified version of the EspWiFiTelnetClient sketch. | |
note: the header file "settings.h" is not included in this repository. | |
Add a new tab in Arduino, call it "settings.h", and Include the following variables: | |
char ssid[] = "ssid"; // your network SSID | |
char password[] = "password"; // your network password | |
char host[] = "192.168.0.2"; // the IP address of the device running the server | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add the stepper motor library | |
#include <Stepper.h> | |
// look at the datasheet to see how many steps are in one full rotation | |
// for instance, if my motor has 200 steps/revolution | |
// it will rotate 1.8° when you tell it to move 1 step | |
// because (360°/200) = 1.8°/revolution | |
const int stepsPerRevolution = 200; | |
// initialize the stepper library on the motor shield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Just a section from the websocket code | |
//Here we are getting the data from the client (browser) | |
// if new text data is received | |
case WStype_TEXT: | |
Serial.printf("[%u] get Text: %s\n", num, payload); | |
//my data value starts with a '#' | |
if (payload[0] == '#') { | |
// decode dropdown data (base 16, 8 bits) | |
uint32_t combinedData = (uint32_t) strtol((const char *) &payload[1], NULL, 16); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Not the full code | |
//just a snippet of where I am sending data to the server | |
function sendToESP(index) { | |
//update string | |
getData(index); | |
//convert data into binary value | |
combinedData = data[0] << 4 | data[1]; | |
//convert data array to string | |
dataStr = '#' + combinedData.toString(16); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ftdifriend.name=FTDI Friend bitbang | |
ftdifriend.communication=serial | |
ftdifriend.protocol=ftdifriend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Code for wifi and sACN protocol is based on Tom Igoe's "sACN intro" example | |
*/ | |
#include <SPI.h> | |
#include <WiFi101.h> | |
//#include <ESP8266WiFi.h> // This should work with the ESP8266 as well. | |
#include <WiFiUdp.h> | |
#include <sACNSource.h> | |
#include "arduino_secrets.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
Reed_Switch_Example.ino | |
Example sketch for SparkFun's Reed Switch | |
(https://www.sparkfun.com/products/8642) | |
Jim Lindblom @ SparkFun Electronics | |
May 3, 2016 | |
The reed switch is a two-terminal, magnetically-actuated, normally-open switch. | |
Connect one end of the switch to ground, and the other to Arduino's D2 pin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Copyright 2017 Google Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SoftwareSerial.h> | |
//switch variables | |
int numSwitch = 8; | |
int switches[] = {A5, A4, A3, A2, A1, A0, 13, 12}; | |
int lastSwitchState[] = {0, 0, 0, 0, 0, 0, 0, 0}; | |
int majChord[] = {0, 1, 2, 2, 3, 4, 5, 5}; | |
//LED variables | |
int LEDPin[] = {11, 10, 9, 8, 7, 6, 5, 4}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require "child_process" to run Child Process Applications | |
var exec = require('child_process').execSync; | |
function say(something) { | |
// "say" in this case is a built-in shell command on MAC OS. | |
command = "say "; | |
exec(command + something); | |
} | |
say("Please enter a U.S. zipcode."); |
NewerOlder