Skip to content

Instantly share code, notes, and snippets.

@circuitsenses
circuitsenses / pir.ino
Created November 28, 2017 15:17
PIR sesor with power saving
#include <avr/sleep.h>
const int32_t led_pin = 13;
const int32_t pir_input_pin = 2;
int32_t pir_state = LOW;
volatile int32_t pinval = 0;
void setup()
{
@circuitsenses
circuitsenses / collatz_intel.c
Last active February 13, 2016 08:56
Collatz Conjecture on Intel Machines
#include <stdio.h>
int main()
{
unsigned long long n = 1;
unsigned long long saved_n = n;
unsigned long long curr_seq_len = 1;
unsigned long long prev_seq_len = 0;
@circuitsenses
circuitsenses / zynq-zybo.dts
Last active August 29, 2015 14:17
DTS file for Zynq ZYBO board from Digilent
/*
* Device Tree for Zybo board
* Partially generated by Device Tree Generator 1.1
*
* (C) Copyright 2007-2013 Xilinx, Inc.
* (C) Copyright 2007-2013 Michal Simek
* (C) Copyright 2007-2012 PetaLogix Qld Pty Ltd
* (C) Copyright 2014 Digilent, Inc.
*
* Michal SIMEK <monstr@monstr.eu>
@circuitsenses
circuitsenses / BTGrid.ino
Last active August 29, 2015 14:07
NeoPixel Shield RGB Light Wireless control over Bluetooth
/*
Adafruit NeoPixel Shield RGB Light Wireless control over Bluetooth
Author : Rishi F.
Adapted from the code written by - http://kuchenzeit.wordpress.com/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
/*
Brainfuck Interpreter Code.
http://en.wikipedia.org/wiki/Brainfuck
A recursive, stack based implementation in C
Scaling Options:
MAX_CELLS - Increase cell count depending on brainfuck program
MAX_STACK_SZ - Increase stack size.
@circuitsenses
circuitsenses / sort.s
Last active February 15, 2024 22:24
Bubble sort ARM assembly implementation
AREA ARM, CODE, READONLY
CODE32
PRESERVE8
EXPORT __sortc
; r0 = &arr[0]
; r1 = length
__sortc
@circuitsenses
circuitsenses / main.c
Last active August 29, 2015 14:06
Bubble sort ARM assembly implementation
#define MAX_ELEMENTS 10
extern void __sortc(int *, int);
int main()
{
int arr[MAX_ELEMENTS] = {5, 4, 1, 3, 2, 12, 55, 64, 77, 10};
__sortc(arr, MAX_ELEMENTS);
@circuitsenses
circuitsenses / ads7843_touch.ino
Created August 31, 2014 06:12
ADS7843 Touchscreen
#include <ads7843.h>
#define DCLK 51 // SCLK
#define CS 46 // CS
#define DIN 48 // MISO
#define DOUT 47 // MOSI
#define IRQ 49
@circuitsenses
circuitsenses / UTFT_Fonts.ino
Created August 30, 2014 16:15
Armjishu TFT LCD + Arduino Mega
// UTFT_ViewFont (C)2012 Henning Karlsen
// web: http://www.henningkarlsen.com/electronics
//
// This program is a demo of the included fonts.
//
// This demo was made for modules with a screen resolution
// of 320x240 pixels.
//
// This program requires the UTFT library.
//
@circuitsenses
circuitsenses / wave.ino
Created August 29, 2014 14:48
WaveForm
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { "Your MAC" };