Skip to content

Instantly share code, notes, and snippets.

View emilyofficial's full-sized avatar

Emily emilyofficial

View GitHub Profile
@emilyofficial
emilyofficial / web-ble-arduino-temp-and-RGB-controls.ino
Created November 4, 2019 21:39
Arduino code to send data-points for current temp taken using DS18B20 temp sensor via an HM-10 BLE module, as well as to receive RGB values from sliders a website and update an RGB LED
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
SoftwareSerial ble(2, 3); // RX, TX
byte sineWave[] = {128,168,203,232,250,255,250,232,203,168,128,88,53,24,6,0,6,24,53,88};
byte current = 0;
byte incoming = 0;
@emilyofficial
emilyofficial / web-ble-arduino-temp.ino
Created November 3, 2019 16:36
Arduino code to send data-points for current temp taken using DS18B20 temp sensor via an HM-10 BLE module
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
SoftwareSerial ble(2, 3); // RX, TX
byte sineWave[] = {128,168,203,232,250,255,250,232,203,168,128,88,53,24,6,0,6,24,53,88};
byte current = 0;
OneWire oneWire(4);
@emilyofficial
emilyofficial / web-ble-arduino.ino
Created October 31, 2019 03:25
Arduino code to send data-points for a sine wave via an HM-10 BLE module
#include <SoftwareSerial.h>
SoftwareSerial ble(2, 3); // RX, TX
byte sineWave[] = {128,168,203,232,250,255,250,232,203,168,128,88,53,24,6,0,6,24,53,88};
byte current = 0;
void setup() {
Serial.begin(9600);
ble.begin(9600);
}
@emilyofficial
emilyofficial / index.html
Created June 27, 2018 22:27
Responsive Inline Frame Embed Code, Google Data Studio Report
<link rel="stylesheet" href="main.css" />
<div class="responsive-inline-frame">
<div class="responsive-inline-frame-inner">
<iframe src="https://datastudio.google.com/embed/reporting/1KdAXcyb-l5X6FR9Vigu8-ExNirb5pNoB/page/MZES" frameborder="0" allowfullscreen></iframe>
</div>
</div>
@emilyofficial
emilyofficial / build.gradle
Created June 15, 2017 14:59 — forked from Dierk/build.gradle
build.gradle for setting up a new gradle-based project
apply plugin:'groovy'
apply plugin:'idea'
repositories { mavenCentral() }
dependencies {
groovy 'org.codehaus.groovy:groovy-all:1.8.2'
//random comment to offset height of embedded gist
//random comment to offset height of embedded gist
//random comment to offset height of embedded gist
@emilyofficial
emilyofficial / mothers.c
Created May 8, 2016 21:47
Arduino code to print text to an oscilloscope
const uint8_t fontWidth = 8;
const unsigned char font[96][8] = {
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //
{0x00,0x5f,0x00,0x00,0x00,0x00,0x00,0x00}, // !
{0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00}, // "
{0x0a,0x1f,0x0a,0x1f,0x0a,0x00,0x00,0x00}, // #
{0x24,0x2a,0x2a,0x7f,0x2a,0x2a,0x12,0x00}, // $
{0x00,0x47,0x25,0x17,0x08,0x74,0x52,0x71}, // %
{0x00,0x36,0x49,0x49,0x49,0x41,0x41,0x38}, // &
{0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00}, // '
#include <iostream>
#include <cstring>
int readPage(int page, uint8_t *dest);
int writePage(int page, uint8_t *src);
const int EEPROM_SIZE = 32000; //bytes
const int PAGE_SIZE = 64; //bytes
uint8_t data[EEPROM_SIZE];
@emilyofficial
emilyofficial / integerPalindrome.java
Created February 6, 2016 21:06
We demonstrate the importance of using correct algorithms when doing simple numerical tasks and how one task can take orders of magnitude less time to complete if implemented more efficiently.
public class reverse {
public static void main(String[] args) {
long x = 98735420298374322L;
long reverse;
long start = System.nanoTime();
reverse = reverseIntrinsic(x);
import Cocoa
class LinearCongruntialGenerator {
var state = 0 //seed of 0 by default
let a, c, m, shift: Int
//we will use microsoft random by default
init() {
self.a = 214013
@emilyofficial
emilyofficial / arrayLength.swift
Created February 5, 2016 20:22
A Swift implementation of array length code, for use on Rosetta Code website
import Cocoa //include Cocoa library (standard in OS X)
let fruits = ["apple", "orange"] //declare constant array literal
let fruitsCount = fruits.count //declare constant array length (count)
print(fruitsCount) //print array length to output window