Skip to content

Instantly share code, notes, and snippets.

use cortex_m::peripheral;
use cortex_m_rt::entry;
use panic_halt as _;
use stm32f3xx_hal::{pac, delay, prelude::*};
fn main() -> ! {
* Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman
* Permission is hereby granted, free of charge, to anyone
* obtaining a copy of this document and accompanying files,
* to do whatever they want with them without any restriction,
* including, but not limited to, copying, modification and redistribution.
* This example sends a valid LoRaWAN packet with payload "Hello,
kinasmith / HCHO_Riffle_Logger.ino
Last active April 19, 2018 01:42
This is a chunk of code to do simple datalogging of an Analog Input with the PublicLab Riffle
For the Riffle Datalogger
Sketch logs the Temperature and Humidity from a SHT21 sensor
at an interval.
It uses the RTC as a scheduler by using an Alarm and Interrupt
pin to wake up the ATmega at an interval.
It logs to the SD card and outputs time and values in the Serial
This Sketch uses the SdFat.h library instead of the SD.h library that is
kinasmith / analogInputToSerialOutput.ino
Last active April 15, 2018 00:14
Simple analog input to serial output conversion
Barebones sketch to read an analog voltage between 0 and 100mV.
An internal reference voltage of 1.1v is used to scale the digital conversion.
The maximum output of the HCHO sensor (typically 100mV) is converted to a value of 103.
This value of 103 should equal a reading of 1000ppb HCHO.
If the maximum output of the sensor is greater than 100mV, a reading of greater than 1000ppb is posible.
int analogPin = 3; // Tip of output HCHO sensor jack connected to analog pin 3
// Ring of HCHO sensor connector connected to GND
kinasmith / Seconds!.ino
Last active March 28, 2018 02:08
display seconds in binary 2 digits
#include "Time.h"
int ledsec1_1 = 12;
int ledsec1_2 = 11;
int ledsec1_4 = 10;
int ledsec1_8 = 9;
int ledsec2_1 = 8;
int ledsec2_2 = 7;
int ledsec2_4 = 6;
kinasmith / time_simple.ino
Created March 22, 2018 03:33
time usage of time library
#include "Time.h"
// read this:
// read this:
// ask me about what doesn't make sense.
//void setTime(int hr,int min,int sec,int day, int month, int yr);
void setup() {
setTime(21,29,00,21,03,2018); //hour, minute, second, day, month, year
kinasmith / if_statement.ino
Last active March 21, 2018 03:40
using an if statement to display binary numbers
int led1 = 9;
int led2 = 10;
int led4 = 11;
int led8 = 12;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
kinasmith / working_loop.ino
Created May 10, 2017 18:54
sd and clock and radio working in LOOP
bool write_to_sd = false;
if (radio.receiveDone())
if (radio.SENDERID == 2) {
write_to_sd = true;
if (radio.ACKRequested()) {
kinasmith / testSD_RFM_init.ino
Created May 9, 2017 22:48
testing initialization of SD card and RFM69HCW radio
#include <RFM69.h> //get it here:
#include <RFM69_ATC.h>
#include "Arduino.h"
// Use the external SPI SD card as storage
#include <SPI.h>
#include <SD.h>
SHT2x - A Humidity Library for Arduino.
Supported Sensor modules:
SHT21-Breakout Module -
SHT2x-Breakout Module -
Created by Christopher Ladden at Modern Device on December 2009.
Modified by Paul Badger March 2010