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 example is running on a PIC16F1704 @ 4Mhz INTOSC */ | |
/* To use it you need to configure your OSC and other things. */ | |
/* The SIGNAL pin of the DHT11 is wired to the RA4 pin */ | |
/* We add a little margin for all timing (~) */ | |
/* Some information about the DHT11 : */ | |
/* http://akizukidenshi.com/download/ds/aosong/DHT11.pdf */ | |
/******************************************************************************/ | |
#include <xc.h> |
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
#import <Foundation/Foundation.h> | |
int main (void) { | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
NSLog(@"Hello World!\n"); | |
[pool release]; | |
return 0; | |
} |
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 $(GNUSTEP_MAKEFILES)/common.make | |
# make a simple program in Objective-C | |
TOOL_NAME = App | |
# The implementation Objective-C file which is going to be compiled | |
App_OBJC_FILES = main.m | |
# Header files of your project | |
#App_HEADER_FILES = xxx.h | |
# Define compilation flags | |
ADDITIONAL_CPPFLAGS = -Wall -Wno-import | |
# Include rules for creating a command line tool for Objective-C |
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
uint16_t map(uint16_t value, uint16_t fS, uint16_t fE, uint16_t tS, uint16_t tE) { | |
return ((long)(value - fS) * (long)(tE - tS)) / ((fE - fS) + tS); | |
} | |
// map(512, 0, 1024, 0, 512); > 127 |
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 "xc.h" | |
#include "config.h" | |
#define BUFSIZE 12 //Maximum size of received string | |
volatile unsigned char rx_data; | |
volatile unsigned char rx_index; | |
volatile unsigned char rx_buffer[BUFSIZE]; | |
/** |
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 "xc.h" | |
#include "config.h" | |
#define _XTAL_FREQ 8000000 | |
/* Variables */ | |
unsigned int i; | |
void setDuty(unsigned int duty) { | |
CCPR1L = duty >> 2; |
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 "xc.h" | |
#include "config.h" | |
#define _XTAL_FREQ 4000000 | |
unsigned short pot = 0; | |
void interrupt isr() { | |
// Disable GIE (best practice?) |
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 <stdio.h> | |
int map(int value, int fromStart, int fromEnd, int toStart, int toEnd) { | |
return (value - fromStart) * (toEnd - toStart) / (fromEnd - fromStart) + toStart; | |
} | |
int main(void) { | |
int x = map(50, 0, 100, 0, 255); | |
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
//Includes | |
#include <stdio.h> | |
#include <stdlib.h> // EXIT_xxxxx | |
#include <string.h> //memset | |
#include <unistd.h> //close | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <arpa/inet.h> | |
//SNTP RFC > https://tools.ietf.org/html/rfc4330 |
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
/* Includes ------------------------------------------------------------------*/ | |
#include <stdio.h> | |
#include "STM32F4xx.h" | |
/* Private variables ---------------------------------------------------------*/ | |
struct __FILE { int handle; }; | |
FILE __stdout; | |
FILE __stdin; | |
/* Private functions ---------------------------------------------------------*/ |