Skip to content

Instantly share code, notes, and snippets.

Avatar

Uri Shaked urish

View GitHub Profile
@urish
urish / wokwi-fibo256-generator.js
Last active Jan 10, 2021
Generate Wokwi diagram with Fibonacci LED pattern
View wokwi-fibo256-generator.js
// Sample output: https://wokwi.com/arduino/projects/287356481917944333
const size = 256;
const center = [150, 150];
const c = 16;
const data = {
version: 1,
author: 'Uri Shaked',
editor: 'wokwi',
@urish
urish / webar-hello-world.html
Last active Aug 31, 2020
WebAR Hello World
View webar-hello-world.html
<script src="https://aframe.io/releases/0.7.1/aframe.min.js"></script>
<script src="https://google-ar.github.io/three.ar.js/dist/three.ar.js"></script>
<script src="https://rawgit.com/chenzlabs/aframe-ar/827e9db/dist/aframe-ar.min.js"></script>
<body>
<a-scene ar>
<a-box width="0.25" height="0.25" depth="0.25" position="-0.25 0.125 -0.75" rotation="0 45 0" color="#4CC3D9"></a-box>
<a-sphere position="0 0.3125 -1.25" radius="0.3125" color="#EF2D5E"></a-sphere>
<a-cylinder position="0.25 0.1875 -0.75" radius="0.125" height="0.375" color="#FFC65D"></a-cylinder>
<a-plane position="0 0 -1" rotation="-90 0 0" width="1" height="1" color="#7BC8A4" shadow></a-plane>
</a-scene>
@urish
urish / README.md
Last active Aug 2, 2020
Upgrading CR-20 to SKR Mini E3 v2.0
View README.md

Connecting the LCD Screen

Use female jumper wires to connect the 2x5 connector on the SKR board with the EXP1 / EXP2 connectors on the LCD board as follows:

Function SKR Connector Pin EXP1/2 EXP Pin Number
LCD_SCK 1 EXP2 9
BTN_ENC 2 EXP1 9
BTN_EN1 3 EXP2 8
RESET 4 - -
View diff-analog-read.ino
int diffAnalogRead(){
int readA[6], minA, maxA;
int readB[6], minB, maxB;
for (int i = 0; i < 6; i++) {
if (i % 2 == 0) {
readA[i] = analogRead(CLK_PIN);
}
readB[i] = analogRead(DIN_PIN);
if (i % 2 == 1) {
readA[i] = analogRead(CLK_PIN);
@urish
urish / typewiz-instrument.ts
Created Mar 7, 2018
Barebone example of how typescript instruments your source code
View typewiz-instrument.ts
import * as fs from 'fs';
import * as ts from 'typescript';
class Replacement {
public static insert(pos: number, text: string) {
return new Replacement(pos, pos, text);
}
constructor(readonly start: number, readonly end: number, readonly text = '') {}
}
@urish
urish / espruino-waveshare-epaper.js
Last active Jul 11, 2020
Driver for Waveshare 2.9inch e-Paper Module
View espruino-waveshare-epaper.js
// Copyright (C) 2017, Uri Shaked
// Loosely based on code samples provided by waveshare
// License: MIT
const DIN_PIN = 11;
const CLK_PIN = 12;
const CS_PIN = 13;
const DC_PIN = 14;
const RST_PIN = 15;
const BUSY_PIN = 16;
@urish
urish / espruino-walker.js
Created Jun 13, 2020
Walking person animation for Espruino
View espruino-walker.js
// LCD Animation: walk
// Code auto-generated by https://wokwi.com/animator, graphics by icons8.com
const frames = [
new Uint8Array([0,0,0,0,0,0,192,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,128,0,0,15,224,0,0,24,32,0,0,48,48,0,0,68,56,0,0,204,108,0,0,188,103,128,1,188,112,128,1,40,94,128,3,104,195,128,1,216,192,0,1,152,64,0,0,28,96,0,0,22,48,0,0,19,16,0,0,51,152,0,0,38,216,0,0,68,200,0,0,204,72,0,1,152,76,0,1,48,108,0,1,224,56,0,0,64,16,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,192,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,128,0,0,15,224,0,0,24,32,0,0,48,48,0,0,100,56,0,0,204,108,0,0,156,103,0,1,188,113,128,1,40,222,128,1,104,199,128,1,88,192,0,1,216,192,0,0,28,96,0,0,22,48,0,0,19,16,0,0,51,144,0,0,38,152,0,0,100,200,0,0,204,72,0,1,152,76,0,1,176,108,0,0,224,56,0,0,64,16,0,0,0,0,0]),
new Uint8Array([0,0,0,0,0,0,192,0,0,1,240,0,0,3,16,0,0,3,24,0,0,3,16,0,0,1,240,0,0,0,192,0,0,3,192,0,0,15,224,0,0,24,32,0,0,48,48,0,0,100,48,0,0,76,120,0,0,220,110,0,0,156,97,128,0,
@urish
urish / avr8js-intro-resources.md
Last active Mar 19, 2020
AVR8js session - links to resources
View avr8js-intro-resources.md
View trex-bitmap-to-text.js
const bmpjs = require('bmp-js');
const fs = require('fs');
const happyb = fs.readFileSync('./happy-birthday.bmp');
const bitmap = bmpjs.decode(happyb);
for (x = 0; x < bitmap.width; x++) {
let line = '';
for (y = 0; y < bitmap.height; y++) {
line += bitmap.data[y * bitmap.width * 4 + (bitmap.width - 1 - x) * 4 + 1] ? ' ' : '#';
}
console.log(line);
@urish
urish / badge-stm32-eeprom.ino
Created Feb 15, 2020
Badge addon id firmware for STM32
View badge-stm32-eeprom.ino
/**
STM32 Fake EEPROM Firmware
Copyright (C) 2020, Uri Shaked. Released under the MIT license.
*/
#include <Wire.h>
#define EEPROM_ADDR 0x50
You can’t perform that action at this time.