This file contains 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
/* A simple ADC example that checks the analog reading on ADC0 and turns | |
* an LED on if the reading is higher than a threshold value and turns if | |
* off if it is under that value. */ | |
#include <avr/io.h> | |
#include <stdint.h> | |
/* Which analog pin we want to read from. The pins are labeled "ADC0" | |
* "ADC1" etc on the pinout in the data sheet. In this case ADC_PIN | |
* being 0 means we want to use ADC0. On the ATmega328P this is also | |
* the same as pin PC0 */ |
This file contains 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
#include <avr/io.h> | |
#include <avr/interrupt.h> | |
#include <stdbool.h> | |
/* | |
* A global flag used to communicate between the Interrupt Service Routine | |
* and the main program. It has to be declared volatile or the compiler | |
* might optimize it out. | |
*/ | |
volatile bool update = false; |
This file contains 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
#include <avr/io.h> | |
#include <util/delay.h> | |
void ioInit(void); //Initializes IO | |
int main (void) { | |
ioInit(); //Setup IO pins and defaults | |
while(1) | |
{ | |
// PORTC = 0xFF; |
This file contains 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
; Calculate each factorial from 1! -> N! where N the initial value | |
; of register B. When finished it pops each result into register J. | |
SET B, 5 | |
SET C, 0 | |
:LOOP | |
ADD C, 1 | |
SET A, C | |
JSR FACTORIAL |
This file contains 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
#include <stdlib.h> | |
#include <assert.h> | |
#include "deque.h" | |
struct node_struct { | |
struct node_struct *next; | |
struct node_struct *prev; | |
deque_val_type val; | |
}; |
This file contains 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
#include <malloc.h> | |
#include "class.h" | |
/* This is the actual implementation of the class. | |
* Because this file isn't included by main.c | |
* code in main.c can not access foo except through | |
* the functions declared in class.h. | |
*/ | |
struct my_class_s { | |
int foo; |
This file contains 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
#include <avr/pgmspace.h> | |
#include "progmem.h" | |
int main() {} |
This file contains 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
main=mapM_ putStrLn[case(if x`mod`3==0then"Fizz"else"")++(if x`mod`5==0then"Buzz"else"")of""->show x;s->s|x<-[1..100]] |
This file contains 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
package main; | |
import ( | |
"exp/gui" | |
"exp/gui/x11" | |
"image" | |
) | |
func main() { | |
w,_ := x11.NewWindow() |
This file contains 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
/* | |
* This is a parser intended for Common Log Format access logs. | |
* It splits on whitespace unless it is part of a field delimited by | |
* square brackets or double quotes. | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include "parser.h" |