Skip to content

Instantly share code, notes, and snippets.

@adielfernandez
adielfernandez / OFtoArduino
Last active March 10, 2018 23:29
Arduino serial string parsing (from OF string sending)
//This code is for sending data from OpenFrameworks to Arduino. This will package 3 values for the arduino
//to read as a string. This code supports values from -2,147,483,648 to 2,147,483,647, not just 0-255!
//(since we're storing them on the arduino side as long variables)
//------------------------------OpenFrameworks string sending------------------------------
//The code below will send the values 12345, 0 and 255.
//----------in header file----------
// MPU-6050 Short Example Sketch
// By Arduino User JohnChi
// August 17, 2014
// Public Domain
#include<Wire.h>
const int MPU=0x68; // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
void setup(){
Wire.begin();
Wire.beginTransmission(MPU);
Current Frame (ofApp): 0
Current Frame (on_frame_ready): 0
Current Frame (on_frame_ready): 0
Cam 1 Frame Number: 0
Current Frame (ofApp): 1
Current Frame (on_frame_ready): 1
Current Frame (on_frame_ready): 1
Cam 1 Frame Number: 1
#ifndef FrameCounter_h
#define FrameCounter_h
#endif /* FrameCounter_h */
#include "ofMain.h"
#pragma once
@adielfernandez
adielfernandez / contrast.frag
Last active February 8, 2018 20:40
Simple Contrast Adjustment Shader
#version 330 core
in vec2 vTexCoord0;
out vec4 oColor;
uniform sampler2D uTex0;
uniform vec2 uResolution;
uniform float uExponent; //good values will be between 5 and 15
uniform float uShift; //good values will be between 0 and 1
@adielfernandez
adielfernandez / gaussian.txt
Created March 7, 2018 23:24
Normalized Gaussian Distribution
float x;
float y = (1.0f / (0.4f * sqrt( glm::two_pi<float>() ) )) * exp( -0.5f * pow( ( x - 0.5f )/0.13, 2 ) );
@adielfernandez
adielfernandez / header.h
Created June 7, 2018 18:58
realsense2 to OF workflow
rs2::device_list _deviceList;
rs2::config _config;
rs2::pipeline _pipeline;
uint16_t *_depthBuff;
ofTexture _depthTex;
[
{
"nid" : 17,
"title" : "baby's first sequence",
"active" : true,
"sequence_slides" : [
{
"nid": 0,
"title": "INNOVATION! Title slide",
"template_type" : "title_text",
{
"contentBroadcast" : {
"playlistId" : 189,
"faces" : [
{
"currentId" : 12,
"faceNum" : 0,
"nextId" : 174
},
{
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/Log.h"
#include "cinder/Serial.h"
#include "Cinder-Serial.h"
using namespace ci;
using namespace ci::app;