Skip to content

Instantly share code, notes, and snippets.

Avatar

Uri Shaked urish

View GitHub Profile
@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 / 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
View kicad-resize-footprint.py
#!/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 Nov 27, 2019
Blink LEDs according to Switch state on AVR8/atmega2560 - GCC version
View Prac2-gcc.asm
; 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
View print-bacteria-and-shake-gcode.py
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')
@urish
urish / fix-inkscape-gcode.py
Created Jul 24, 2019
Fix GCode generated by Inkscape
View fix-inkscape-gcode.py
import re
f = open('dna_pattern.gcode', 'r')
output = open('dna_output.gcode', 'w')
output.write('; Home\nG28\n')
for line in f:
line = line.strip()
if line[0:1] == '(':
output.write('; ' + re.sub(r'^\s*\(|\)\s*$', '', line) + '\n')
if line[0:2] == 'G0':
You can’t perform that action at this time.