Skip to content

Instantly share code, notes, and snippets.

View bacalj's full-sized avatar
🤔

Joseph Bacal bacalj

🤔
View GitHub Profile
@bacalj
bacalj / ccemgfsr2023.ino
Created June 27, 2023 12:53
Dataflow + BYB Gripper 2023
/*
* ----------------------------------------------------------------------------------------------------
* Muscle SpikerShield Arduino UNO Code for Interface with Dataflow
*
* This sketch allows for two way communication between Concord Consortium's Dataflow Tile and
* Backyard Brains' Muscle Spiker Shield & associated hardware. The FSR and EMG sensor pins are set
* to match the 2023 Gripper/Shield combination.
*
* Based on original script by Backyard Brains 2015, by Marcio Amorim and Stanislav Mircic
* Adapted by Concord Consortium, 2023.
@bacalj
bacalj / break-up-tick.ts
Last active April 6, 2023 03:41
proposed break up of tick
private tick = () => {
const {tileModel, playBackIndex, isPlaying} = this.props;
const dataSet = tileModel.dataSet;
const now = Date.now();
this.setState({lastIntervalDuration: now - this.lastIntervalTime});
this.lastIntervalTime = now;
const isCleared = this.props.programRecordState === 0;
const isRecording = this.props.programRecordState === 1;
const isRecorded = this.props.programRecordState === 2;
@bacalj
bacalj / baisc_listen_for_radio_pass_to_serial.js
Last active March 30, 2023 16:39
most basic microbit to dataflow
/**
* micro:bit + Dataflow: "Listener Program"
*
* This is the basic program for the micro:bit physically attached to the computer.
* A companion program "Broadcaster Program" runs on the micro:bits not physically attached to the computer.
*
* An alternative approach would use the same program on all microbits, with lots of mode-checking.
* This is here as a proof-of-concept
*
* [ A ] - mode 1 - "awake" : pass `name:value` rxed from from radio to serial (dataflow)
@bacalj
bacalj / led_strip2014_highergain.ino
Last active November 9, 2022 19:35
Copied from downloaded sketch from Backyard Brains help site: https://backyardbrains.com/experiments/muscleSpikerShield
#define NUM_LED 6 //sets the maximum numbers of LEDs
#define MAX 150 //maximum posible reading. TWEAK THIS VALUE!!
int reading[10];
int finalReading;
byte litLeds = 0;
byte multiplier = 1;
byte leds[] = {8, 9, 10, 11, 12, 13};
void setup(){
Serial.begin(9600); //begin serial communications
@bacalj
bacalj / artLogicFilteredFeed.js
Last active June 23, 2022 22:34
netlify function - aggregates three pages of an artlogic feed and only returns the data we care about
const fetch = require('node-fetch')
function deCloudinaried(url){
const urlTokenized = url.split('/')
urlTokenized.splice(3,1)
const basicUrl = urlTokenized.join('/')
return basicUrl
}
let urls = [
@bacalj
bacalj / artLogicImport.js
Last active May 17, 2022 01:52
import from artlogic to sanity - WIP
import {
getArtistIdMap,
getFeedItems,
createDocsFromItems
} from './artistUtils'
let artistIdsMap;
let feedItems;
let startingIndex;
let endingIndex;
@bacalj
bacalj / send-email.js
Created April 2, 2022 18:32
Netlify's Example Nodemailer Function, thanks Netlify CLI
// with thanks to https://github.com/Urigo/graphql-modules/blob/8cb2fd7d9938a856f83e4eee2081384533771904/website/lambda/contact.js
const process = require('process')
const { promisify } = require('util')
const sendMailLib = require('sendmail')
const { validateEmail, validateLength } = require('./validations')
const sendMail = promisify(sendMailLib())
@bacalj
bacalj / sanity-create.js
Created October 30, 2021 01:29
Example netlify function writing to sanity - taken right from what CLI generates
const process = require('process')
const sanityClient = require('@sanity/client')
// You will need to configure environment variables for Sanity.io project id,
// dataset name, and a token with write access. The variables are named
//
// SANITY_PROJECTID
// SANITY_DATASET
// SANITY_TOKEN
@bacalj
bacalj / author.js
Created July 25, 2021 15:15
The blog schema that comes in the Sanity.io blog template, for reference
export default {
name: 'author',
title: 'Author',
type: 'document',
fields: [
{
name: 'name',
title: 'Name',
type: 'string',
},