Skip to content

Instantly share code, notes, and snippets.

Avatar

oldhandmixer hekras

  • Software developer and more
  • Denmark
View GitHub Profile
@hekras
hekras / poly-into.bas
Created Nov 29, 2021
A rotating star for CMM2
View poly-into.bas
' draws triangle with polygon
const dots=13
dim xp(dots)
dim yp(dots)
radius=250
start_angle=0
dangle=0.005
@hekras
hekras / cmm2-virusswweper-2021.bas
Created Oct 23, 2021
Virus sweeper for CMM2 BASIC
View cmm2-virusswweper-2021.bas
'==================================
'Virus sweeper
'By Henryk K 2021.10.19
'==================================
option explicit
const grid.xmax = 51
const grid.ymax = 37
dim integer grid.squares
const gg.bomb = 0 ' is there a bomb i the square
const gg.checked = 1 ' has the square been checked
@hekras
hekras / tones-tracker.bas
Created Jul 31, 2021
CMM2 tones tracker
View tones-tracker.bas
'==================================
'Tones tracker
'By Henryk K 2021.07.18
'==================================
option explicit
'dim tones(16)
dim string note.name$(97)
dim float note.freq(97)
dim integer note.oct%=4
@hekras
hekras / square-invader-mouse.bas
Last active Jul 11, 2021
CMM2 Invaders with mouse support
View square-invader-mouse.bas
option explicit
mode 1,8
dim integer xpos=400, ypos=400 ' player positien
dim integer xmax, xmin ' invader x-bounds
dim float xoff=0, yoff=0, dx=1 'x-pos invaders
dim integer shooter = 0 ' spacebar shoot latch
dim integer q_action = 0 ' Q-key latch
dim integer missile_mode = 0, state = 0, state_counter
dim integer game_over = 0
@hekras
hekras / cmm2-tones.bas
Created Jul 3, 2021
Colour Maximite 2 tones
View cmm2-tones.bas
dim tones(16)
for i=0 to bound(tones())-1
read tones(i)
next i
tempo=50
for i=0 to 20
a% = rnd * bound(tones())
play tone tones(a%), tones(a%), tempo
@hekras
hekras / Relay-and-LED-Shift-Register.bas
Created Jun 30, 2021
Testing 2 modules on the PS Labs CMM2 Expansion cards
View Relay-and-LED-Shift-Register.bas
SETPIN 31, DOUT 'set pin 31 to latch the relay card
SETPIN 33, DOUT 'set pin 33 to latch the shift register card
SPI OPEN 195315, 0, 16 'mode 0, data size is 16 bits
LED2 = 1
LED1 = 1
do
@hekras
hekras / Realy-module-test.bas
Last active Jun 30, 2021
Testing the Colour Maximite 2 Exapansion bourd with the Relay module
View Realy-module-test.bas
SETPIN 31, DOUT 'set pin 31 to latch the chip
SPI OPEN 195315, 0, 16 'mode 0, data size is 16 bits
LED1 = &B01011
PIN(31) = 0
junk = SPI(LED1)
PIN(31) = 1
PAUSE(5000)
@hekras
hekras / square-invaders.bas
Last active Jul 3, 2021
invaders game ... weekend project
View square-invaders.bas
option explicit
mode 1,8
dim integer xpos=400, ypos=400 ' player positien
dim integer xmax, xmin ' invader x-bounds
dim float xoff=0, yoff=0, dx=1 'x-pos invaders
dim integer shooter = 0 ' spacebar shoot latch
dim integer q_action = 0 ' Q-key latch
dim integer missile_mode = 0, state = 0, state_counter
dim integer game_over = 0
View 2021-05-23-RGB-LED-LAMP.ino
// NeoPixel test program showing use of the WHITE channel for RGBW
// pixels only (won't look correct on regular RGB NeoPixel strips).
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1:
View demo.html
<!DOCTYPE html>
<html>
<head>
<link rel="apple-touch-icon" sizes="57x57" href="../apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="../apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="../apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="../apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="../apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="../apple-icon-120x120.png">