Skip to content

Instantly share code, notes, and snippets.

View Mr-Coxall's full-sized avatar

Patrick Coxall Mr-Coxall

  • St. Mother Teresa HS
  • Ottawa
View GitHub Profile
@Mr-Coxall
Mr-Coxall / hello_world_international.py
Last active July 1, 2018 02:30
hello_world_international.pdf
# Created by: Mr. Coxall
# Created on: Aug 2018
# Created for: ICS3U
# This program is the Hello, World program, but with 3 buttons
import ui
def english_touch_up_inside(sender):
# displays the English version
view['hello_world_label'].text = ('Hello, World!')
@Mr-Coxall
Mr-Coxall / address_gui.py
Last active July 1, 2018 02:25
address_gui.py
# Created by: Mr. Coxall
# Created on: Aug 2018
# Created for: ICS3U
# This program is the Address program, but with a GUI
import ui
v = ui.load_view()
v.present('sheet')
@Mr-Coxall
Mr-Coxall / hello_world_gui.py
Last active July 1, 2018 02:25
hello_world_gui.py
# Created by: Mr. Coxall
# Created on: Aug 2018
# Created for: ICS3U
# This program is the Hello, World program, but with a GUI
import ui
view = ui.load_view()
view.present('sheet')
@Mr-Coxall
Mr-Coxall / address_with_button.py
Last active July 1, 2018 02:23
address_with_button.py
# Created by: Mr. Coxall
# Created on: Aug 2018
# Created for: ICS3U
# This program is the Address progran, but with a button
import ui
def show_address_touch_up_inside(sender):
#print ('Hello, World!')
view['name_label'].text = ("Mr. Coxall")
@Mr-Coxall
Mr-Coxall / hello_world_button.py
Last active July 1, 2018 02:23
hello_world_button.py
# Created by: Mr. Coxall
# Created on: Aug 2018
# Created for: ICS3U
# This program is the Hello, World program, but with a button
import ui
def hello_world_touch_up_inside(sender):
#print ('Hello, World!')
view['hello_world_label'].text = ("Hello, World!")
# Mr. Coxall
from microbit import *
def convert_dec_to_bin(int_number, binary_digits):
# convert a decimal number to binary stored in an array
if int_number < 0:
# it is a negative number
positive_equivalent = pow(2, binary_digits)-abs(int_number)-1
answer = bin(~positive_equivalent)
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-- Created by: Mr. Coxall
-- Created on: Jan 2018
--
-- This file animates a charact using a spritesheet
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-- Created by: Mr. Coxall
-- Created on: Jan 2018
--
-- This file animates a charact using a spritesheet
-----------------------------------------------------------------------------------------
# Mr. Coxall
# This Micro:Bit Python code goes through all the combinations of 2 44-bit positive binary numbers
from microbit import *
# variable holding the decimal value of a button
a_input = 0
a_input_as_binary = []
b_input = 0
b_input_as_binary = []
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Gravity
local physics = require( "physics" )