
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
import machine, time | |
tft.init(tft.ILI9341, width=320, height=320, miso=19, mosi=23, clk=18, cs=14, dc=27, bgr=True, backl_pin=32, rst_pin=33, backl_on=1, spihost=tft.VSPI, invrot=2) | |
tft.orient(2) | |
tft.font(tft.FONT_7seg, color=tft.WHITE) | |
while True: | |
now = machine.RTC().now() | |
txt = "%02d:%02d:%02d" % now[3:6] |
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
#!/usr/bin/python | |
# -*- coding: UTF-8 -*- | |
import serial, time, struct | |
import httplib, urllib | |
ser = serial.Serial("/dev/ttyUSB0", baudrate=9600, stopbits=1, parity="N", timeout=2) | |
ser.flushInput() |
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
def scale_to_fit(image, frame, enlarge=False): | |
image_width, image_height = image | |
frame_width, frame_height = frame | |
image_aspect = float(image_width) / image_height | |
frame_aspect = float(frame_width) / frame_height | |
# Determine maximum width/height (prevent up-scaling). | |
if not enlarge: | |
max_width = min(frame_width, image_width) | |
max_height = min(frame_height, image_height) | |
else: |
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
SET @entityid = '3'; | |
SELECT ea.attribute_id, ea.attribute_code, eav.value AS 'value', 'varchar' AS 'type' | |
FROM catalog_category_entity e | |
JOIN catalog_category_entity_varchar eav | |
ON e.entity_id = eav.entity_id | |
JOIN eav_attribute ea | |
ON eav.attribute_id = ea.attribute_id | |
WHERE e.entity_id = @entityid | |
UNION |
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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
var should_rotate = true; | |
Robot.prototype.onIdle = function(ev) { |
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
var cannon_rotate = 1; | |
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onWallCollision = function(ev) { | |
var robot = ev.robot; | |
robot.back(10); |
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
var locked = false; | |
var numlock = 0; | |
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
if (!locked) { |