This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Go | |
| ;; Requires: go get github.com/rogpeppe/godef | |
| ;; go get github.com/nsf/gocode | |
| (defun jim-go-mode () | |
| ;; gofmt on save. | |
| (add-hook 'before-save-hook 'gofmt-before-save) | |
| ;; Add flymake support for go. | |
| (require 'flymake-go) | |
| (flymake-mode) | |
| ;; Auto-complete support |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Package manager for ELPA (and add MELPA). | |
| (require 'package) | |
| (add-to-list 'package-archives | |
| '("melpa" . "https://melpa.org/packages/")) | |
| (package-initialize) | |
| ;; Function to install all required packages on a new machine. | |
| (defun jim-install-packages () | |
| (interactive) | |
| (defvar jim-packages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mov %a, 0 | |
| mov %b, %a | |
| mov %c, %a | |
| mov %d, %a | |
| mov %e, %a | |
| mov %f, %a | |
| loop: | |
| ; Write output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from microbit import * | |
| import ustruct | |
| def color565(r, g, b): | |
| return (r & 0xf8) << 8 | (g & 0xfc) << 3 | b >> 3 | |
| class Display: | |
| _INIT = ( | |
| (0xFD, b'\x12'), (0xFD, b'\xb1'), (0xAE, b''), (0xB2, b'\xa4\x00\x00'), (0xB3, b'\xf0'), (0xCA, b'\x7f'), (0xA0, b'\x74'), (0xA1, b'\x00'), (0xA2, b'\x00'), (0xB5, b'\x00'), (0xAB, b'\x01'), (0xB1, b'\x32'), (0xBB, b'\x1f'), (0xBE, b'\x05'), (0xA6, b''), (0xC1, b'\xc8\x80\xc8'), (0xC7, b'\x0a'), (0xB4, b'\xa0\xb5\x55'), (0xB6, b'\x01'), (0xAF, b''), | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from microbit import * | |
| import gc | |
| DISTANCE_CM_PER_BIT = 0.21 | |
| DISTANCE_OFFSET = 1.8 | |
| TRIG_PIN = pin0 | |
| ECHO_PIN = pin1 | |
| spi.init(baudrate=50000,bits=8,mode=0,miso=ECHO_PIN) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from microbit import * | |
| display.scroll('hello micro:bit') | |
| while True: | |
| if button_a.was_pressed(): | |
| display.show(Image.HEART) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from microbit import * | |
| n = 0 | |
| while True: | |
| if button_a.was_pressed(): | |
| n += 1 | |
| display.scroll(str(n)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from microbit import * | |
| n = 0 | |
| while True: | |
| if button_a.was_pressed(): | |
| n += 1 | |
| display.scroll(str(n), wait=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from microbit import * | |
| while True: | |
| if button_a.was_pressed(): | |
| display.show(Image.SQUARE) | |
| sleep(5000) | |
| display.clear() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from microbit import * | |
| while True: | |
| if button_a.was_pressed(): | |
| display.show(Image.SQUARE) | |
| sleep(5000) | |
| display.clear() | |
| if button_b.was_pressed(): | |
| display.clear() |
OlderNewer