Skip to content

Instantly share code, notes, and snippets.

// This #include statement was automatically added by the Particle IDE.
#include <MQTT.h>
MQTT client("XXX.XXX.XXX.XXX", 1883, callback);
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
@gingemonster
gingemonster / noisexamplegbdk.c
Created January 12, 2019 22:18
Example of noise sound in GBDK
#include <gb/gb.h>
#include <stdio.h>
void main(){
// these registers must be in this specific order!
NR52_REG = 0x80; // is 1000 0000 in binary and turns on sound
NR50_REG = 0x77; // sets the volume for both left and right channel just set to max 0x77
NR51_REG = 0xFF; // is 1111 1111 in binary, select which chanels we want to use in this case all of them. One bit for the L one bit for the R of all four channels
@gingemonster
gingemonster / main.c
Created January 12, 2019 11:31
Simple sound effect sample GameBoy GBDK
#include <gb/gb.h>
#include <stdio.h>
void main(){
// these registers must be in this specific order!
NR52_REG = 0x80; // is 1000 0000 in binary and turns on sound
NR50_REG = 0x77; // sets the volume for both left and right channel just set to max 0x77
NR51_REG = 0xFF; // is 1111 1111 in binary, select which chanels we want to use in this case all of them. One bit for the L one bit for the R of all four channels
@gingemonster
gingemonster / mapbox gl large json clipping issue
Created December 3, 2018 16:21
mapbox gl large json clipping issue
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Add a GeoJSON polygon</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.51.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.51.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
c:\gbdk\bin\lcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -c -o main.o main.c
c:\gbdk\bin\lcc -Wa-l -Wl-m -Wl-j -DUSE_SFR_FOR_REG -o main.gb main.o
@gingemonster
gingemonster / WarGames.js
Created December 7, 2016 19:07
Micromonsters Episode 7 - WarGames code
let opponentsmissile: game.LedSprite = null
let missile: game.LedSprite = null
let switchxposition = 0
let player = game.createSprite(2, 4)
let nummissles = 0
input.onButtonPressed(Button.A, () => {
player.change(LedSpriteProperty.X, -1)
})
input.onButtonPressed(Button.B, () => {
player.change(LedSpriteProperty.X, 1)
@gingemonster
gingemonster / adventofcode-day5-2.cs
Last active December 5, 2016 22:00
Adventofcode Day 5 - Challenge 2
using System;
using System.Security.Cryptography;
using System.Text;
using System.Linq;
using System.Diagnostics;
namespace ConsoleApplication
{
public class Program
{
@gingemonster
gingemonster / adventofcode-day5-1.cs
Created December 5, 2016 07:36
Adventofcode Day 5 - Challenge 1
using System;
using System.Security.Cryptography;
using System.Text;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
@gingemonster
gingemonster / adventofcode-day4-2.cs
Created December 4, 2016 07:50
Adventofcode Day 4 - Challenge 2
using System;
using System.IO;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
namespace ConsoleApplication
{
public class Program
{
@gingemonster
gingemonster / adventofcode-day4-1.cs
Last active December 4, 2016 18:55
Adventofcode Day 4 - Challenge 1
using System;
using System.IO;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
namespace ConsoleApplication
{
public class Program
{