Skip to content

Instantly share code, notes, and snippets.

@headHUB
headHUB / struct_union.ino
Created July 12, 2021 15:10 — forked from nonsintetic/struct_union.ino
Arduino structures and unions
/* Arduino data manipulation and concatenation with structures and unions
*
* This simple (ish) sketch shows you how to organize your data into a struct
* and then access the whole thing as a byte array.
*
* Useful if you want to concatenate several variables into a single byte array
* to send over bluetooth, i2c, lora or any other protocol that works with arrays.
* In other words you have a fixed byte array, and we squeeze in variables of different
* data types and lengths into it, while still using it as a byte array afterwards.
*
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Install dlib and face_recognition on a Raspberry Pi

Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.

Steps

Download the latest Raspbian Jessie Light image. Earlier versions of Raspbian won't work.

Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.

#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <VarServoSpeed>
//zoomkat 11-12-13 String capture and parsing
//from serial port input (via serial monitor)
//and print result out serial port
//copy test strings and use ctrl/v to paste in
//serial monitor if desired
// * is used as the data string delimiter
// , is used to delimit individual data
String readString; //main captured String
import serial
import pygame
# allow multiple joysticks
joy = []
# Arduino USB port address (try "COM5" on Win32)
usbport = "/dev/ttyUSB0"
# define usb serial connection to Arduino
import serial
ser = serial.Serial(‘/dev/ttyAMA0’, 9600, timeout=1)
ser.open()
ser.write(“testing”)
try:
while 1:
response = ser.readline()
const int ledPin = 12;
void setup(){
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop(){
if (Serial.available()) {