Skip to content

Instantly share code, notes, and snippets.

View vgonisanz's full-sized avatar

Víctor Goñi Sanz vgonisanz

View GitHub Profile
/*
* How configure UART to use printf using avr-libc, reference: http://www.nongnu.org/avr-libc/user-manual/index.html
* This code was compiled using arduino-cmake: https://github.com/arduino-cmake/arduino-cmake.git
* cmake -DINPUT_BOARD=pro -DINPUT_PORT=/dev/ttyUSB0 -DBOARD_CPU=16MHzatmega328 ..
* make
* make upload # push reset button before
*/
#if ARDUINO >= 100
#include "Arduino.h"
@vgonisanz
vgonisanz / 0_reuse_code.js
Created July 21, 2017 14:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@vgonisanz
vgonisanz / InterfaceFromCJNI.java
Last active February 25, 2016 09:05
Class to get calls from C++
// Usage
//
// 1º In MainActivity class, onCreate method, add this line:
// InterfaceFromCJNI.callbackMainActivity = this;
// 2º Add this function, defined as interface in InterfaceFromCJNI class:
// @Override
// public void msgFromC(String message)
// {
// // Your own
// Log.d(LOG_TAG, "msgFromC is: " + message);
@vgonisanz
vgonisanz / InterfaceToCJNI.java
Created February 25, 2016 08:52
Example in javafile
// Java package
package com.github.vgoni;
// Imports
import android.util.Log;
public final class InterfaceToCJNI
{
// Load Native C/C++ Libraries
// =========================================================================
@vgonisanz
vgonisanz / logger.h
Last active November 9, 2021 07:17
Simple header to print logs in Android/iOS,Windows/Linux/Mac
#pragma once
// Usage:
// VGONI_DEBUG_LOGS 1 = Print logs, if 0 won't.
// LOGD = Debug, LOGI = Info, LOGE = Error, LOGW = Warning, LOGV = Verbose
// 1º Include this header in the cpp to use logs
// 2º Add in top of the file: #define LOG_TAG "CppNameOrID"
// 3º LOGD("Your message: %s in position %d", variable.c_str(), myInt);
//
// Example In myFile.cpp:
@vgonisanz
vgonisanz / WebBanner.html
Last active February 9, 2016 11:26
WebBanner
<!-- Incrustar:
<iframe src="https://rawgit.com/vgonisanz/1bc6625bc62f15d44efa/raw/8a891d9f97c7777ac50ccb3f1c7381d88a05e511/WebBanner.html" scrolling="no" width=260px height=280px frameborder="0"></iframe>
-->
<!-- Javascript Code -->
<script>
function copyToClipboard(object) {
object.focus();
object.select();
document.execCommand('copy');
alert("Copiado al Portapapeles");