Skip to content

Instantly share code, notes, and snippets.

#include "DigiKeyboard.h"
bool pressing = false;
void setup() {
pinMode(0, INPUT);
digitalWrite(0, HIGH); // Pull Up
}
void loop() {
#include <Bounce.h>
Bounce button = Bounce(1, 10);
void setup() {
pinMode(1, INPUT_PULLUP);
}
void loop() {
button.update();
@bricklife
bricklife / LiveView.swift
Created September 26, 2017 00:50
PlaygroundBluetooth Example
//: A UIKit based Playground for presenting user interface
import UIKit
import CoreBluetooth
import PlaygroundBluetooth
import PlaygroundSupport
private let serviceUuid = CBUUID(string: "180F")
private let characteristicUuid = CBUUID(string: "2A19")
@bricklife
bricklife / overwrite_main.py
Last active January 16, 2020 03:33
Overwriting main.py in LEGO Education SPIKE Prime Hub
import io
f = io.open('main.py', 'w')
f.write('''
import hub
import time
while True:
hub.display.show(hub.Image('00000:00000:00900:00000:00000:'))
time.sleep_ms(500)
@bricklife
bricklife / main.py
Last active January 16, 2020 03:15
main.py in LEGO Education SPIKE Prime Hub
import gc
import micropython
import hub_runtime
micropython.alloc_emergency_exception_buf(256)
hub_runtime.start()
//
// LineHeightLabel.swift
// LineHeightLabel
//
// Created by Shinichiro Oba on 20/06/2018.
// Copyright © 2018 bricklife.com. All rights reserved.
//
import UIKit
//
// BLEPeripheral.swift
// BLEPeripheral
//
// Created by ooba on 26/07/2017.
// Copyright © 2017 mercari. All rights reserved.
//
import Foundation
import CoreBluetooth
@bricklife
bricklife / BLEPeripheral.swift
Created September 14, 2018 16:43
micro:bit simulator for Scratch 3.0
//
// BLEPeripheral.swift
// BLEPeripheral
//
// Created by ooba on 26/07/2017.
// Copyright © 2017 bricklife.com. All rights reserved.
//
import Foundation
import CoreBluetooth
@bricklife
bricklife / gist:68a04a6171063c8429a9
Last active May 9, 2018 05:25
Resizable inputAccessoryView on UITableView in iOS 8
import UIKit
class InputAccessoryTableViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.becomeFirstResponder()
}
//
// BLEDump.swift
// BLEDump
//
// Created by Shinichiro Oba on 2017/07/25.
// Copyright © 2017 Shinichiro Oba. All rights reserved.
//
import Foundation
import CoreBluetooth