Skip to content

Instantly share code, notes, and snippets.

View urish's full-sized avatar

Uri Shaked urish

View GitHub Profile
@urish
urish / wokwi-fibo256-generator.js
Last active January 10, 2021 18:52
Generate Wokwi diagram with Fibonacci LED pattern
// 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 / README.md
Last active August 2, 2020 18:23
Upgrading CR-20 to SKR Mini E3 v2.0

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 - -
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 / espruino-walker.js
Created June 13, 2020 20:42
Walking person animation for Espruino
// 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 March 19, 2020 22:08
AVR8js session - links to resources
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 February 15, 2020 13:50
Badge addon id firmware for STM32
/**
STM32 Fake EEPROM Firmware
Copyright (C) 2020, Uri Shaked. Released under the MIT license.
*/
#include <Wire.h>
#define EEPROM_ADDR 0x50
#!/usr/bin/env python3
# coding=utf8
#
# Simple script to scale a KiCad footprint
# Usage:
# python kicad-resize-footprint.py <input.kicad_mod> <output.kicad_mod> <scale>
#
# Where scale is how much to scale (1 = 100%)
#
# Copyright (C) 2020, Uri Shaked.
@urish
urish / Prac2-gcc.asm
Created November 27, 2019 08:09
Blink LEDs according to Switch state on AVR8/atmega2560 - GCC version
; Created: 25/11/2019 9:45:37 AM
; Author : Annon
; defining some labels to make the code easier to read
LEDs = 20
Switches = 21
outer = 22
inner = 23
inner1 = 24
import re
PAINT_X = 172
PAINT_Y = 92
PAINT_Z = 40.5
MOVEOVER_Z = 55
SHAKE_RADIUS = 1
f = open('dna_pattern.gcode', 'r')
output = open('dna_output.gcode', 'w')