Add binary data file to Arduino sketch - arduino

Is it possible to add an binary data file together with a Arduino sketch that is transferred when sending it over to the Arduino? I manage to add the file in the IDE and it was copied to a "data" directory in my project folder but I can't find a way to access it in my code.
I'm just interested to send one file for testing purposes and don't want to use SD cards or network. I'm using the Arduino-Uno.

You can convert the binary data to a C array, and insert that into the code/source which will allow you to reference it.
A tool like Hexworkshop or other binary file editor should have an option to do this for you.
You could check this answer as well.
Example output:
unsigned char data[84] = {
0x02, 0x00, 0x41, 0x8E, 0x08, 0x8F, 0x09, 0x85, 0x09, 0x82, 0x85, 0x08, 0x83, 0xE0, 0xFE, 0xA3,
0xE0, 0x8E, 0x0A, 0xF5, 0x0B, 0x4E, 0x70, 0xEF, 0x85, 0x09, 0x82, 0x85, 0x08, 0x83, 0xE0, 0xFE,
0xA3, 0xE0, 0xFF, 0x7C, 0x00, 0x7D, 0x00, 0x02, 0x00, 0x00, 0x7B, 0x00, 0x7A, 0x00, 0x79, 0x01,
0x80, 0x06, 0x7B, 0x00, 0x7A, 0x00, 0x79, 0x00, 0x8A, 0x0A, 0x89, 0x0B, 0xE9, 0x4A, 0x70, 0xD8,
0x22, 0x78, 0x7F, 0xE4, 0xF6, 0xD8, 0xFD, 0x75, 0x81, 0x0B, 0x02, 0x00, 0x4D, 0x7F, 0x00, 0x7E,
0x80, 0x02, 0x00, 0x03,
} ;

Related

Memosense pH probe communication CRC reverse engeneering

I need some help with CRC calculation. I spent a week trying to understand how a CRC (or Checksum) is calculated on a communication protocol
I have a Endress+Hauser pH probe (CPS11D-7FA21) that has MemoSense connector. Basically it is a digital pH probe. The communication is RS485 but the protocol is proprietary, so no info on that.
I connected the probe to a meter and sniffed the frames. There is a lot of data going back and fourth in the beginning but the polling repeats.
I was able to write some code for an Arduino and it worked, I can initialize the probe and pool measurements (ph(mV) and temperature), but the problem is that it only work with one probe. If I connect a new one it all stops.
I was digging a bit and I found out that right before the pooling starts the Init frame is different... Ii seem the measuring device somehow calculates the Init data from some other data that is exchanged in the beginning.
Anyway the fist thing is that I want to understand how the data frame is constructed.
Here is an example of pooling one of the probes and the data changes slightly
0x01, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x04, 0x03, 0x09, 0x00, 0x20, 0xb9
0x01, 0x01, 0x00, 0x00, 0x00, 0x2f, 0x04, 0x03, 0x09, 0x00, 0x21, 0x99
0x01, 0x01, 0x00, 0x00, 0x00, 0x30, 0x04, 0x03, 0x09, 0x00, 0x3e, 0x7a
0x01, 0x01, 0x00, 0x00, 0x00, 0x32, 0x04, 0x03, 0x09, 0x00, 0x3c, 0x3a
0x01, 0x01, 0x00, 0x00, 0x00, 0x33, 0x04, 0x03, 0x09, 0x00, 0x3d, 0x1a
| <-------------------> | \ / \ / | | |
Header pH(mV)/10 Temp/100 ? Csum CRC???
0x01, 0x01, 0x00, 0x00, 0x00, 0x8d, 0x06, 0xf4, 0x08, 0x00, 0x77, 0x56
0x01, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x06, 0xf4, 0x08, 0x00, 0x75, 0x16
0x01, 0x01, 0x00, 0x00, 0x00, 0x88, 0x06, 0xf4, 0x08, 0x00, 0x72, 0xf6
0x01, 0x01, 0x00, 0x00, 0x00, 0x94, 0x06, 0xf5, 0x08, 0x00, 0x6f, 0x7d
0x01, 0x09, 0x04, 0x00, 0x0c, 0x00, 0x14, 0x02, 0x03, 0x11, 0x36, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x20, 0x20, 0x20, 0x20, 0x46, 0x57
0x01, 0x09, 0x04, 0x00, 0x0c, 0x00, 0x15, 0x07, 0x17, 0x12, 0x26, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x20, 0x20, 0x20, 0x20, 0x45, 0xb0
0x01, 0x00, 0x04, 0x00, 0x05, 0xa8, 0x4b, 0x53, 0x47, 0x31, 0x20, 0x01, 0x01, 0x01, 0x5a, 0x02, 0x9f, 0x27, 0x40, 0x39, 0x3f, 0x04, 0x52, 0x31, 0x32, 0x38, 0x44, 0x46, 0x30, 0x35, 0x42, 0x30, 0x33, 0x14, 0x01, 0x16, 0x00, 0x69, 0x00
0x01, 0x00, 0x04, 0x00, 0x05, 0xa8, 0x4b, 0x53, 0x47, 0x31, 0x20, 0x01, 0x01, 0x01, 0x01, 0x00, 0x75, 0x27, 0x41, 0xb8, 0x41, 0x04, 0x53, 0x36, 0x33, 0x37, 0x45, 0x44, 0x30, 0x35, 0x42, 0x30, 0x37, 0x15, 0x07, 0x06, 0x00, 0x3c, 0xf3
0x01, 0x08, 0x04, 0x00, 0x0d, 0xb0, 0xe5, 0x69, 0x1b, 0x00, 0x00, 0x69, 0x1b, 0x15, 0x07, 0x17, 0x12, 0x26, 0x02, 0x44, 0x1b, 0xaa, 0x0f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x20, 0x20, 0x20, 0x20, 0xe9, 0xcd
0x01, 0x08, 0x04, 0x00, 0x0d, 0x40, 0xe7, 0x58, 0x1b, 0x00, 0x00, 0x67, 0x1b, 0x14, 0x02, 0x03, 0x11, 0x36, 0x02, 0x44, 0x1b, 0xaa, 0x0f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x20, 0x20, 0x20, 0x20, 0x27, 0xde
Here is what I learned so far, the Csum is a standard 8bit Xor checksum
that works here
https://www.scadacore.com/tools/programming-calculators/online-checksum-calculator/
But the CRC is a mystery for me ... I tried multiple calculator and different data pieces and nothing. To me it seems it is a CRC because the if one bit changes there is a huge difference in the CRC byte
Maybe someone here could shed some light on this
Thank you
The last byte appears to be an exclusive-or and rotate check on the non-header bytes. If the message with check values is the unsigned char array a[0..len-1], then this computes the last two check values, x == a[len - 2] and y == a[len - 1]:
unsigned x = 0, y = 0;
for (size_t i = 0; i < len - 2; i++)
x ^= a[i];
for (size_t i = 5; i < len - 2; i++) {
y = (y ^ a[i]) << 1;
if (y & 0x100)
y ^= 0x101;
}

Custom QQuick3DGeometry does not display

Trying to implement a custom geometry for QtQuick3D:
mycustomgeometry.h:
#ifndef MYCUSTOMGEOMETRY_H
#define MYCUSTOMGEOMETRY_H
#include <QQuick3DGeometry>
class MyCustomGeometry : public QQuick3DGeometry
{
Q_OBJECT
public:
MyCustomGeometry();
virtual ~MyCustomGeometry();
signals:
public slots:
void setData(QByteArray vertexData, QByteArray indexData);
};
#endif // MYCUSTOMGEOMETRY_H
mycustomgeometry.cpp:
#include "mycustomgeometry.h"
#include <QVector3D>
// simulate data coming from my application (should look like a cut cuboid)
static unsigned char vertexData[] = {
0x00, 0x00, 0xe0, 0xb3, 0x8c, 0xca, 0x4c, 0xbd, 0x1c, 0x63, 0x89, 0x3d,
0x00, 0x00, 0x60, 0x35, 0x0c, 0xcf, 0x4c, 0x3d, 0xa4, 0x61, 0x89, 0x3d,
0x64, 0x2e, 0x37, 0xbd, 0xb8, 0xcc, 0x4c, 0xbd, 0x00, 0x2a, 0xb7, 0xbc,
0x68, 0x2d, 0x37, 0xbd, 0xe4, 0xcc, 0x4c, 0x3d, 0xe0, 0x2f, 0xb7, 0xbc,
0x80, 0x2d, 0x37, 0x3d, 0xa4, 0xcb, 0x4c, 0xbd, 0x18, 0x2f, 0x37, 0x3d,
0x80, 0x2e, 0x37, 0x3d, 0xf0, 0xcd, 0x4c, 0x3d, 0x28, 0x2c, 0x37, 0x3d,
0xd8, 0x2c, 0x37, 0x3d, 0xf8, 0xce, 0x4c, 0xbd, 0xa0, 0x61, 0x89, 0xbd,
0xd8, 0x2d, 0x37, 0x3d, 0xa4, 0xca, 0x4c, 0x3d, 0x20, 0x63, 0x89, 0xbd
};
static unsigned char indexData[] = {
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00
};
MyCustomGeometry::MyCustomGeometry()
{
QByteArray v(reinterpret_cast<char*>(::vertexData), sizeof(::vertexData));
QByteArray i(reinterpret_cast<char*>(::indexData), sizeof(::indexData));
setData(v, i);
}
MyCustomGeometry::~MyCustomGeometry()
{
}
void MyCustomGeometry::setData(QByteArray vertexData, QByteArray indexData)
{
clear();
setPrimitiveType(PrimitiveType::Triangles);
addAttribute(Attribute::PositionSemantic, 0, Attribute::F32Type);
addAttribute(Attribute::IndexSemantic, 0, Attribute::U32Type);
addAttribute(Attribute::NormalSemantic, 0, Attribute::F32Type);
setVertexData(vertexData);
setIndexData(indexData);
setStride(sizeof(float) * 3);
QVector3D boundsMin, boundsMax;
auto vertices = reinterpret_cast<const float*>(vertexData.constData());
for(size_t i = 0; i < vertexData.length() / sizeof(float); i += 3)
{
for(size_t j = 0; j < 3; j++)
{
boundsMin[j] = (std::min(vertices[i + j], i == 0 ? vertices[i + j] : boundsMin[j]));
boundsMax[j] = (std::max(vertices[i + j], i == 0 ? vertices[i + j] : boundsMax[j]));
}
}
setBounds(boundsMin, boundsMax);
}
main.qml:
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick3D 1.15
import QtQuick3D.Helpers 1.15
import QtQuick.Controls 2.15
import MyCustomGeometry 1.0
Window {
id: mainWindow
width: 400
height: 300
visible: true
flags: Qt.Tool
title: qsTr("3D demo")
View3D {
id: view
anchors.fill: parent
camera: camera
renderMode: View3D.Overlay
PerspectiveCamera {
id: camera
position: Qt.vector3d(0, 200, 300)
eulerRotation.x: -30
}
WasdController {
controlledObject: camera
mouseEnabled: true
}
DirectionalLight {
eulerRotation.x: -30
}
Model {
id: cube
objectName: "cube"
visible: true
position: Qt.vector3d(-100, 0, 0)
scale: Qt.vector3d(slider.k, slider.k, slider.k)
source: "#Cube"
materials: [DefaultMaterial {diffuseColor: "red"}]
eulerRotation.y: 90
}
Model {
id: sphere
objectName: "sphere"
visible: true
position: Qt.vector3d(100, 0, 0)
scale: Qt.vector3d(slider.k, slider.k, slider.k)
//source: "#Sphere"
geometry: MyCustomGeometry {}
materials: [DefaultMaterial {diffuseColor: "blue"}]
eulerRotation.y: 90
}
}
Slider {
id: slider
property real k: Math.pow(10, slider.value)
from: -3; to: 6; value: 3
}
}
The cube, and the sphere (when commenting geometry: and uncommenting source:) display correctly.
But the model with the custom geometry does not.
I tried also with 16-bit integers as indices, but got the same result.
Edit: tested on Qt 6.0.0 and it works, so it is a problem limited to Qt 5.15.2
It works on Qt 5 too if setting the name property, as per QTBUG-89420:
MyCustomGeometry::MyCustomGeometry()
{
QByteArray v(reinterpret_cast<char*>(::vertexData), sizeof(::vertexData));
QByteArray i(reinterpret_cast<char*>(::indexData), sizeof(::indexData));
setData(v, i);
setName("MyCustomGeometry");
}

arduino graphic display clear display doesn't work

I am using a Arduino UNO with a c-control programmable graphic display.
I used the documentation of Franzis Maker Kit Grafikdisplays programmieren TURN ON YOUR CREATIVITY .
Display: DXDCG12864-4330 Displaycontroller: ST7564
My code is:
#include "TextDisplay.h"
int i=1;
TextDisplay display = TextDisplay();
void setup() {
display.init(25);
}
void loop() {
char buffer[40];
display.clear();
display.println("ABCD");
sprintf(buffer, " Dw2: %05d", i);
display.println(buffer);
delay(2000);
i++;
}
The problem is that the lines get printed beneath each other and that the display.clear() doesn't clean the display. The display shows after 2 loops:
ABCD
Dw2: 1
ABCD
Dw2: 2
instant of :
ABCD
Dw2: 2
TextDisplay.h:
#ifndef _TEXTDISPLAY_H_
#define _TEXTDISPLAY_H_
#include "Display.h"
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class TextDisplay {
public:
TextDisplay() {};
void init(byte contrast);
void println(const char* string);
void print(const char string);
void clear(void);
byte getLastCharPosition(byte line);
void writeTextBuffer();
private:
Display lcd;
byte textBuffer[8][22];
byte curserPositionY, curserPositionX;
};
#endif
TextDisplay.cpp:
#include "TextDisplay.h"
#include "Display.h"
#include "Font.h"
void TextDisplay::init(byte contrast) {
lcd = Display();
lcd.init(contrast);
lcd.clearDisplayRAM();
lcd.setPageAddress(0);
lcd.setColumnAddress(0);
curserPositionY = 0;
curserPositionX = 0;
textBuffer[MAX_CHARACTERS_Y][MAX_CHARACTERS_X];
}
void TextDisplay::println(const char* string) {
int position = 0;
while (string[position]) {
char character = string[position];
print(character);
string++;
}
print(13);
}
void TextDisplay::clear(void) {
print(255);
}
void TextDisplay::print(char character) {
switch (character) {
case 255:
for (byte y=0; y<MAX_CHARACTERS_Y; y++) {
for (byte x=0; x<MAX_CHARACTERS_X; x++) {
textBuffer[y][x] = 0;
}
}
writeTextBuffer();
curserPositionY = 0;
curserPositionX = 0;
break;
case 127: //Delete (Putty Backspace)
if (curserPositionX == 0 && curserPositionY > 0) {
curserPositionY--;
curserPositionX = getLastCharPosition(curserPositionY);
textBuffer[curserPositionY][curserPositionX] = 0;
}
else if (curserPositionX > 0) {
curserPositionX--;
textBuffer[curserPositionY][curserPositionX] = 0;
}
else {
}
break;
case 13: //CR
if (curserPositionY < MAX_CHARACTERS_Y-1) {
curserPositionY++;
curserPositionX = 0;
}
break;
default:
if (curserPositionX < MAX_CHARACTERS_X) {
textBuffer[curserPositionY][curserPositionX] = character;
curserPositionX++;
}
else if (curserPositionY < MAX_CHARACTERS_Y-1) {
curserPositionY++;
curserPositionX = 0;
textBuffer[curserPositionY][curserPositionX] = character;
curserPositionX++;
}
break;
}
writeTextBuffer();
}
byte TextDisplay::getLastCharPosition(byte line) {
for (byte x=0; x<MAX_CHARACTERS_X; x++) {
if(textBuffer[line][x] == 0) {
return (x!=0) ? x : 0;
}
}
return MAX_CHARACTERS_X-1;
}
void TextDisplay::writeTextBuffer() {
for (byte y=0; y<MAX_CHARACTERS_Y; y++) {
lcd.setPageAddress(y);
lcd.setColumnAddress(0);
for (byte x=0; x<MAX_CHARACTERS_X; x++) {
int position = textBuffer[y][x] * CHARACTER_WIDTH;
for (byte i=0; i<CHARACTER_WIDTH; i++) {
lcd.writeData(pgm_read_byte(font7x5 + position++));
}
}
}
}
Font.h:
#define CHARACTER_WIDTH 6
#define MAX_CHARACTERS_X 22
#define MAX_CHARACTERS_Y 8
const PROGMEM byte font7x5[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char NULL
0x3E, 0x55, 0x51, 0x55, 0x3E, 0x00, // Code for char
0x3E, 0x6B, 0x6F, 0x6B, 0x3E, 0x00, // Code for char
0x0E, 0x1F, 0x3E, 0x1F, 0x0E, 0x00, // Code for char
0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x00, // Code for char
0x98, 0x9B, 0xFF, 0x9B, 0x98, 0x00, // Code for char
0x18, 0x5E, 0x7F, 0x5E, 0x18, 0x00, // Code for char
0x00, 0x08, 0x1C, 0x08, 0x00, 0x00, // Code for char
0x7F, 0x77, 0x63, 0x77, 0x7F, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x30, 0x48, 0x48, 0x3E, 0x07, 0x00, // Code for char
0x06, 0x29, 0x79, 0x29, 0x06, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x60, 0x7E, 0x06, 0x33, 0x3F, 0x00, // Code for char
0x49, 0x3E, 0x63, 0x3E, 0x49, 0x00, // Code for char
0x08, 0x08, 0x7F, 0x08, 0x08, 0x00, // Code for char
0x08, 0x1C, 0x3E, 0x7F, 0x00, 0x00, // Code for char
0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, // Code for char
0x00, 0x5F, 0x00, 0x5F, 0x00, 0x00, // Code for char
0x06, 0x0F, 0x7F, 0x00, 0x7F, 0x00, // Code for char
0x08, 0x08, 0x0F, 0x08, 0x08, 0x00, // Code for char
0x08, 0x08, 0x78, 0x08, 0x08, 0x00, // Code for char
0x00, 0x08, 0x08, 0x7F, 0x00, 0x00, // Code for char
0x04, 0x02, 0x7F, 0x02, 0x04, 0x00, // Code for char
0x00, 0x7F, 0x08, 0x08, 0x00, 0x00, // Code for char
0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, // Code for char
0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, // Code for char !
0x00, 0x03, 0x00, 0x03, 0x00, 0x00, // Code for char "
0x74, 0x1C, 0x77, 0x1C, 0x17, 0x00, // Code for char #
0x24, 0x4A, 0xFF, 0x52, 0x24, 0x00, // Code for char $
0x43, 0x33, 0x08, 0x66, 0x61, 0x00, // Code for char %
0x36, 0x49, 0x55, 0x22, 0x50, 0x00, // Code for char &
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // Code for char '
0x00, 0x00, 0x3E, 0x41, 0x00, 0x00, // Code for char (
0x00, 0x00, 0x41, 0x3E, 0x00, 0x00, // Code for char )
0x00, 0x0A, 0x04, 0x0A, 0x00, 0x00, // Code for char *
0x00, 0x08, 0x1C, 0x08, 0x00, 0x00, // Code for char +
0x00, 0x00, 0xA0, 0x60, 0x00, 0x00, // Code for char ,
0x00, 0x08, 0x08, 0x08, 0x00, 0x00, // Code for char -
0x00, 0x00, 0x60, 0x60, 0x00, 0x00, // Code for char .
0x00, 0x60, 0x1C, 0x03, 0x00, 0x00, // Code for char /
0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, // Code for char 0
0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, // Code for char 1
0x42, 0x61, 0x51, 0x49, 0x46, 0x00, // Code for char 2
0x22, 0x41, 0x49, 0x49, 0x36, 0x00, // Code for char 3
0x1C, 0x13, 0x10, 0x78, 0x10, 0x00, // Code for char 4
0x4F, 0x49, 0x49, 0x49, 0x31, 0x00, // Code for char 5
0x3E, 0x49, 0x49, 0x49, 0x32, 0x00, // Code for char 6
0x01, 0x01, 0x71, 0x09, 0x07, 0x00, // Code for char 7
0x36, 0x49, 0x49, 0x49, 0x36, 0x00, // Code for char 8
0x26, 0x49, 0x49, 0x49, 0x3E, 0x00, // Code for char 9
0x00, 0x00, 0x6C, 0x6C, 0x00, 0x00, // Code for char :
0x00, 0x00, 0xAC, 0x6C, 0x00, 0x00, // Code for char ;
0x00, 0x08, 0x14, 0x22, 0x00, 0x00, // Code for char <
0x00, 0x14, 0x14, 0x14, 0x00, 0x00, // Code for char =
0x00, 0x22, 0x14, 0x08, 0x00, 0x00, // Code for char >
0x02, 0x01, 0x51, 0x09, 0x06, 0x00, // Code for char ?
0x3E, 0x5D, 0x5D, 0x51, 0x5E, 0x00, // Code for char #
0x7E, 0x09, 0x09, 0x09, 0x7E, 0x00, // Code for char A
0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, // Code for char B
0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, // Code for char C
0x7F, 0x41, 0x41, 0x22, 0x1C, 0x00, // Code for char D
0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, // Code for char E
0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, // Code for char F
0x3E, 0x41, 0x41, 0x51, 0x32, 0x00, // Code for char G
0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, // Code for char H
0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, // Code for char I
0x00, 0x20, 0x40, 0x3F, 0x00, 0x00, // Code for char J
0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, // Code for char K
0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, // Code for char L
0x7F, 0x02, 0x0C, 0x02, 0x7F, 0x00, // Code for char M
0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, // Code for char N
0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, // Code for char O
0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, // Code for char P
0x3E, 0x41, 0x41, 0x21, 0x5E, 0x00, // Code for char Q
0x7F, 0x09, 0x09, 0x09, 0x76, 0x00, // Code for char R
0x26, 0x49, 0x49, 0x49, 0x32, 0x00, // Code for char S
0x01, 0x01, 0x7F, 0x01, 0x01, 0x00, // Code for char T
0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, // Code for char U
0x03, 0x1C, 0x60, 0x1C, 0x03, 0x00, // Code for char V
0x1F, 0x60, 0x18, 0x60, 0x1F, 0x00, // Code for char W
0x63, 0x14, 0x08, 0x14, 0x63, 0x00, // Code for char X
0x03, 0x04, 0x78, 0x04, 0x03, 0x00, // Code for char Y
0x61, 0x51, 0x49, 0x45, 0x43, 0x00, // Code for char Z
0x00, 0x00, 0x7F, 0x41, 0x41, 0x00, // Code for char [
0x00, 0x03, 0x1C, 0x60, 0x00, 0x00, // Code for char BackSlash
0x00, 0x41, 0x41, 0x7F, 0x00, 0x00, // Code for char ]
0x00, 0x06, 0x01, 0x06, 0x00, 0x00, // Code for char ^
0x40, 0x40, 0x40, 0x40, 0x40, 0x00, // Code for char _
0x00, 0x00, 0x01, 0x02, 0x00, 0x00, // Code for char `
0x38, 0x44, 0x44, 0x44, 0x7C, 0x00, // Code for char a
0x7F, 0x44, 0x44, 0x44, 0x38, 0x00, // Code for char b
0x38, 0x44, 0x44, 0x44, 0x28, 0x00, // Code for char c
0x38, 0x44, 0x44, 0x44, 0x7F, 0x00, // Code for char d
0x38, 0x54, 0x54, 0x54, 0x58, 0x00, // Code for char e
0x00, 0x04, 0x7E, 0x05, 0x00, 0x00, // Code for char f
0x18, 0xA4, 0xA4, 0xA4, 0x7C, 0x00, // Code for char g
0x7F, 0x04, 0x04, 0x04, 0x78, 0x00, // Code for char h
0x00, 0x00, 0x7D, 0x00, 0x00, 0x00, // Code for char i
0x00, 0x40, 0x3D, 0x00, 0x00, 0x00, // Code for char j
0x7F, 0x20, 0x10, 0x28, 0x44, 0x00, // Code for char k
0x00, 0x00, 0x3F, 0x40, 0x00, 0x00, // Code for char l
0x78, 0x04, 0x78, 0x04, 0x78, 0x00, // Code for char m
0x04, 0x78, 0x04, 0x04, 0x78, 0x00, // Code for char n
0x38, 0x44, 0x44, 0x44, 0x38, 0x00, // Code for char o
0xF8, 0x44, 0x44, 0x44, 0x38, 0x00, // Code for char p
0x38, 0x44, 0x44, 0x44, 0xF8, 0x00, // Code for char q
0x00, 0x7C, 0x08, 0x04, 0x04, 0x00, // Code for char r
0x48, 0x54, 0x54, 0x54, 0x24, 0x00, // Code for char s
0x00, 0x04, 0x3F, 0x44, 0x00, 0x00, // Code for char t
0x3C, 0x40, 0x40, 0x40, 0x7C, 0x00, // Code for char u
0x0C, 0x30, 0x40, 0x30, 0x0C, 0x00, // Code for char v
0x1C, 0x60, 0x1C, 0x60, 0x1C, 0x00, // Code for char w
0x44, 0x28, 0x10, 0x28, 0x44, 0x00, // Code for char x
0x44, 0x48, 0x30, 0x08, 0x04, 0x00, // Code for char y
0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, // Code for char z
0x00, 0x08, 0x36, 0x41, 0x00, 0x00, // Code for char {
0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, // Code for char |
0x00, 0x41, 0x36, 0x08, 0x00, 0x00, // Code for char }
0x08, 0x04, 0x08, 0x08, 0x04, 0x00, // Code for char ~
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x14, 0x3E, 0x55, 0x55, 0x41, 0x00, // Code for char €
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0xA0, 0x60, 0x00, 0x00, // Code for char ‚
0x00, 0x84, 0x7E, 0x05, 0x01, 0x00, // Code for char ƒ
0xA0, 0x60, 0x00, 0xA0, 0x60, 0x00, // Code for char „
0x40, 0x00, 0x40, 0x00, 0x40, 0x00, // Code for char …
0x04, 0x04, 0xFF, 0x04, 0x04, 0x00, // Code for char †
0x24, 0x24, 0xFF, 0x24, 0x24, 0x00, // Code for char ‡
0x00, 0x02, 0x01, 0x02, 0x00, 0x00, // Code for char ˆ
0x63, 0x13, 0x6C, 0x63, 0x60, 0x60, // Code for char ‰
0x48, 0x55, 0x56, 0x55, 0x24, 0x00, // Code for char Š
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ‹
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Œ
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ž
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ‘
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ’
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char “
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ”
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char •
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char –
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char —
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ˜
0x01, 0x07, 0x01, 0x07, 0x03, 0x07, // Code for char ™
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char š
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ›
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char œ
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ž
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ÿ
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¡
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¢
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char £
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¤
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¥
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¦
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char §
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¨
0x7E, 0x81, 0xBD, 0xA5, 0x81, 0x7E, // Code for char ©
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ª
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char «
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¬
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ­
0x7E, 0x81, 0xBD, 0x9D, 0xA1, 0x7E, // Code for char ®
0x01, 0x01, 0x01, 0x01, 0x01, 0x00, // Code for char ¯
0x00, 0x02, 0x05, 0x02, 0x00, 0x00, // Code for char °
0x00, 0x48, 0x5C, 0x48, 0x00, 0x00, // Code for char ±
0x00, 0x09, 0x0D, 0x0A, 0x00, 0x00, // Code for char ²
0x00, 0x09, 0x0D, 0x0F, 0x00, 0x00, // Code for char ³
0x00, 0x00, 0x02, 0x01, 0x00, 0x00, // Code for char ´
0xFC, 0x40, 0x40, 0x40, 0x3C, 0x00, // Code for char µ
0x06, 0x0F, 0xFF, 0x01, 0xFF, 0x01, // Code for char ¶
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ·
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¸
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¹
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char º
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char »
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¼
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ½
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¾
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ¿
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char À
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Á
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Â
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ã
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ä
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Å
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Æ
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ç
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char È
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char É
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ê
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ë
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ì
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Í
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Î
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ï
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ð
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ñ
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ò
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ó
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ô
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Õ
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ö
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ×
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ø
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ù
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ú
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Û
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ü
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Ý
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Þ
0xFE, 0x49, 0x49, 0x56, 0x20, 0x00, // Code for char ß
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char à
0xFE, 0x49, 0x49, 0x56, 0x20, 0x00, // Code for char á
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char â
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ã
0x38, 0x45, 0x44, 0x45, 0x7C, 0x00, // Code for char ä
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char å
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char æ
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ç
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char è
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char é
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ê
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ë
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ì
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char í
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char î
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ï
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ð
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ñ
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ò
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ó
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ô
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char õ
0x30, 0x4A, 0x48, 0x4A, 0x30, 0x00, // Code for char ö
0x08, 0x08, 0x2A, 0x08, 0x08, 0x00, // Code for char ÷
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ø
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ù
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ú
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char û
0x38, 0x42, 0x40, 0x42, 0x78, 0x00, // Code for char ü
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ý
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char þ
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ÿ
0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Code for char
};
Display.h
Can someone tell me whats wrong?
Thanks in advance.
Download BugAVRgcc_Char.zip from http://tiny.systems/categorie/lcdProjekt/FragenAntworten.html and extract the new libraries

SSD1306, DIGISparkOLED not working with teensy3.2

OLED display is not working with teensy3.2 board, but it is working fine with arduino UNO with the same code as below:
#include <U8glib.h>
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does
not send AC
int frame=0;
const uint8_t frame1[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFE, 0x00, 0x3F, 0xFF, 0xFF, 0x00,
0x3F, 0xFF, 0xFF, 0x80,
0x30, 0x00, 0x01, 0x80, 0x33, 0xFF, 0x81, 0xC0, 0x33, 0xFF, 0x81, 0xE0,
0x33, 0xFF, 0x81, 0xE0,
0x33, 0xFF, 0x81, 0xE0, 0x33, 0xFF, 0x81, 0xE0, 0x33, 0xFF, 0x81, 0xE0,
0x33, 0xFF, 0x81, 0xE0,
0x33, 0xFF, 0x81, 0xE0, 0x33, 0xFF, 0x81, 0xC0, 0x30, 0x00, 0x01, 0x80,
0x3F, 0xFF, 0xFF, 0x80,
0x3F, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const uint8_t frame2[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x0F, 0x00,
0x00, 0x09, 0x80, 0x00,
0x08, 0xE0, 0x00, 0x08, 0x38, 0x00, 0x08, 0x1C, 0x0C, 0x08, 0x0F, 0x06,
0x08, 0x1C, 0x03, 0x88,
0x70, 0x00, 0xC8, 0xE0, 0x00, 0x79, 0x80, 0x00, 0x1E, 0x00, 0x00, 0x1E,
0x00, 0x00, 0x79, 0x80,
0x00, 0xC8, 0xE0, 0x03, 0x88, 0x70, 0x06, 0x08, 0x1C, 0x0C, 0x08, 0x0F,
0x00, 0x08, 0x1C, 0x00,
0x08, 0x38, 0x00, 0x08, 0xE0, 0x00, 0x09, 0xC0, 0x00, 0x0F, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
const uint8_t frame3 [] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00,
0x00, 0x01, 0x80, 0x00,
0x00, 0x01, 0xC0, 0x00, 0x00, 0x01, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00,
0x00, 0x03, 0xC0, 0x00,
0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x02, 0x40, 0x00,
0x00, 0x06, 0x40, 0x00,
0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00,
0x00, 0x04, 0x60, 0x00,
0x00, 0x0C, 0x60, 0x00, 0x00, 0x0C, 0x60, 0x00, 0x07, 0xFC, 0x61, 0xFC,
0x07, 0xF8, 0x33, 0xFC,
0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x33, 0x00,
0x00, 0x00, 0x33, 0x00,
0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x3E, 0x00,
0x00, 0x00, 0x1E, 0x00,
0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x00,
0x00, 0x00, 0x1C, 0x00,
0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const uint8_t frame4[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xE0, 0x00, 0x00, 0x01, 0xFF,
0xF8, 0x00, 0x00, 0x07,
0xFF, 0xFE, 0x00, 0x00, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x3F, 0xFF, 0xFF,
0x80, 0x00, 0x7F, 0xFF,
0xFF, 0xC0, 0x00, 0xFF, 0xFF, 0xFF, 0xF0, 0x01, 0xFF, 0xFF, 0xFF, 0xF0,
0x01, 0xFF, 0xFF, 0xFE,
0xF8, 0x03, 0xFF, 0xFF, 0xFC, 0x78, 0x03, 0xFF, 0xFF, 0xF8, 0x7C, 0x07,
0xFF, 0xFF, 0xF0, 0xFC,
0x07, 0xFF, 0xFF, 0xE1, 0xFC, 0x0F, 0xFF, 0xFF, 0xC3, 0xFE, 0x0F, 0xFF,
0xFF, 0x87, 0xFE, 0x0F,
0xFF, 0xFF, 0x0F, 0xFE, 0x0F, 0xF3, 0xFE, 0x1F, 0xFE, 0x0F, 0xE1, 0xFC,
0x3F, 0xFE, 0x0F, 0xE0,
0xF8, 0x7F, 0xFE, 0x0F, 0xF0, 0x70, 0xFF, 0xFE, 0x0F, 0xF8, 0x21, 0xFF,
0xFE, 0x0F, 0xFC, 0x03,
0xFF, 0xFE, 0x07, 0xFE, 0x07, 0xFF, 0xFC, 0x07, 0xFF, 0x0F, 0xFF, 0xFC,
0x07, 0xFF, 0x9F, 0xFF,
0xFC, 0x03, 0xFF, 0xFF, 0xFF, 0xF8, 0x01, 0xFF, 0xFF, 0xFF, 0xF8, 0x01,
0xFF, 0xFF, 0xFF, 0xF0,
0x00, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x7F, 0xFF, 0xFF, 0xC0, 0x00, 0x3F,
0xFF, 0xFF, 0x80, 0x00,
0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x0F, 0xFF, 0xFE, 0x00, 0x00, 0x03, 0xFF,
0xF8, 0x00, 0x00, 0x00,
0x7F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
void setup(void) {
}
void loop(void) {
u8g.firstPage();
do{
draw();
}while(u8g.nextPage());
frame++;
if(frame == 13)
frame=0;
delay(1000);
}
void draw(){
if(frame == 0 )
{ u8g.drawBitmapP(0,0,4,20,frame1);
u8g.drawBitmapP(103,0,3.5,28, frame2);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(20,45,"11:45");
u8g.setFont(u8g_font_helvB12);
u8g.drawStr(100,60,"AM");
}
if(frame == 1 )
{ u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(0,20,"Heart Rate");
u8g.setFont(u8g_font_helvR24);
u8g.drawStr(25,60,"75");
u8g.setFont(u8g_font_helvB12);
u8g.drawStr(90,60,"BPM");
}
if(frame == 2 )
{ u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(10,20,"Analysing");
u8g.drawBitmap(10,30,4,32, frame3);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(50,58,"10");
u8g.setFont(u8g_font_profont22);
u8g.drawStr(90,58,"sec");
}
if(frame == 3 )
{ u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(10,20,"Analysing");
u8g.drawBitmap(10,30,4,32, frame3);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(60,58,"9");
u8g.setFont(u8g_font_profont22);
u8g.drawStr(90,58,"sec");
}
if(frame == 4 )
{ u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(10,20,"Analysing");
u8g.drawBitmap(10,30,4,32, frame3);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(60,58,"8");
u8g.setFont(u8g_font_profont22);
u8g.drawStr(90,58,"sec");
}
if(frame == 5 )
{ u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(10,20,"Analysing");
u8g.drawBitmap(10,30,4,32, frame3);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(60,58,"7");
u8g.setFont(u8g_font_profont22);
u8g.drawStr(90,58,"sec");
}
if(frame == 6 )
{ u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(10,20,"Analysing");
u8g.drawBitmap(10,30,4,32, frame3);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(60,58,"6");
u8g.setFont(u8g_font_profont22);
u8g.drawStr(90,58,"sec");
}
if(frame == 7 )
{ u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(10,20,"Analysing");
u8g.drawBitmap(10,30,4,32, frame3);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(60,58,"5");
u8g.setFont(u8g_font_profont22);
u8g.drawStr(90,58,"sec");
}
if(frame == 8 )
{ u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(10,20,"Analysing");
u8g.drawBitmap(10,30,4,32, frame3);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(60,58,"4");
u8g.setFont(u8g_font_profont22);
u8g.drawStr(90,58,"sec");
}
if(frame == 9 )
{ u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(10,20,"Analysing");
u8g.drawBitmap(10,30,4,32, frame3);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(60,58,"3");
u8g.setFont(u8g_font_profont22);
u8g.drawStr(90,58,"sec");
}
if(frame == 10 )
{ u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(10,20,"Analysing");
u8g.drawBitmap(10,30,4,32, frame3);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(60,58,"2");
u8g.setFont(u8g_font_profont22);
u8g.drawStr(90,58,"sec");
}
if(frame == 11 )
{u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(10,20,"Analysing");
u8g.drawBitmap(10,30,4,32, frame3);
u8g.setFont(u8g_font_helvR24);
u8g.setColorIndex(1);
u8g.drawStr(60,58,"1");
u8g.setFont(u8g_font_profont22);
u8g.drawStr(90,58,"sec");
}
if(frame == 12)
{u8g.drawBitmapP(45,0,5.375,43, frame4);
u8g.setFont(u8g_font_profont22);
u8g.setColorIndex(1);
u8g.drawStr(45,58,"Done");
}
}
Their are no compiling errors. The OLED is not even turning on. AND on scanning the address comes out to be 0X3C.I have searched a lot on google but i think theirs and issue in I2C communication.
Please help me out.
#vasu Hi I had the same problem but please also check for any hardware faults before following my answer.
The oled display I bought only had VCC-GND-SCL-SDA. So I don't have a reset PIN here.
But the oled library initially tries to pull the reset PIN high on startup. Since I don't have a reset pin, it sits there and waits for a reset HIGH. So in order to initialise your oled display without reset pin then try this in your Arduino sketch file
//1-->Manually set HIGH to digitally assigned reset pin
pinMode(A4, OUTPUT); //A4 is reset pin assigned programmatically (for example)
digitalWrite(A4, HIGH);
//2-->Try changing your init to this
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);
//As this will be the right one to define from the user manual shown in the link
//https://reprap.org/forum/file.php?267,file=54605
Try the above and let me know how it went.
Cheers

Using Curve25519 on javacard

I'm looking into using curve25519 on a javacard 3.0.4 but I got stuck and I have the following questions:
Does javacard 3.0.4 support such a curve?
What I've tried so far was to convert the Montgomery equation to a Weierstrass equation. Doing this and using Bernstein's website I got the following parameters:
p = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed
a = 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa984914a144
b = 0x7b425ed097b425ed097b425ed097b425ed097b425ed097b4260b5e9c7710c864
r = 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed
Gx = 0x9
Gy = 0x20ae19a1b8a086b4e01edd2c7748d14c923d4d7e6d7c61b229e9c5a27eced3d9
As I found some other values on the internet I also tried with
Gx: 0x2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaad245a
Then I followed the implementation from ykneo-curves and ended up with this:
public class Curve25519 {
public final static byte[] p = { // 32 bytes
(byte) 0x7f, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xed };
public final static byte[] a = { // 32 bytes
(byte) 0x2a, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa,
(byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa,
(byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0xaa,
(byte) 0xaa, (byte) 0xaa, (byte) 0xaa, (byte) 0x98, (byte) 0x49, (byte) 0x14, (byte) 0xa1, (byte) 0x44 };
public final static byte[] b = { // 32 bytes
(byte) 0x7b, (byte) 0x42, (byte) 0x5e, (byte) 0xd0, (byte) 0x97, (byte) 0xb4, (byte) 0x25, (byte) 0xed,
(byte) 0x09, (byte) 0x7b, (byte) 0x42, (byte) 0x5e, (byte) 0xd0, (byte) 0x97, (byte) 0xb4, (byte) 0x25,
(byte) 0xed, (byte) 0x09, (byte) 0x7b, (byte) 0x42, (byte) 0x5e, (byte) 0xd0, (byte) 0x97, (byte) 0xb4,
(byte) 0x26, (byte) 0x0b, (byte) 0x5e, (byte) 0x9c, (byte) 0x77, (byte) 0x10, (byte) 0xc8, (byte) 0x64 };
public final static byte[] G = { // 65 bytes
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x09, (byte) 0x20, (byte) 0xae, (byte) 0x19, (byte) 0xa1, (byte) 0xb8, (byte) 0xa0, (byte) 0x86,
(byte) 0xb4, (byte) 0xe0, (byte) 0x1e, (byte) 0xdd, (byte) 0x2c, (byte) 0x77, (byte) 0x48, (byte) 0xd1,
(byte) 0x4c, (byte) 0x92, (byte) 0x3d, (byte) 0x4d, (byte) 0x7e, (byte) 0x6d, (byte) 0x7c, (byte) 0x61,
(byte) 0xb2, (byte) 0x29, (byte) 0xe9, (byte) 0xc5, (byte) 0xa2, (byte) 0x7e, (byte) 0xce, (byte) 0xd3,
(byte) 0xd9 };
public final static byte[] r = { // 32 bytes
(byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x14, (byte) 0xde, (byte) 0xf9, (byte) 0xde, (byte) 0xa2, (byte) 0xf7, (byte) 0x9c, (byte) 0xd6,
(byte) 0x58, (byte) 0x12, (byte) 0x63, (byte) 0x1a, (byte) 0x5c, (byte) 0xf5, (byte) 0xd3, (byte) 0xed };
static public KeyPair newKeyPair() {
KeyPair kp = new KeyPair(KeyPair.ALG_EC_FP, (short) 256);
ECPrivateKey ecPrv = (ECPrivateKey) kp.getPrivate();
ECPublicKey ecPub = (ECPublicKey) kp.getPublic();
ecPrv.setFieldFP(p, (short) 0, (short) p.length);
ecPrv.setA(a, (short) 0, (short) a.length);
ecPrv.setB(b, (short) 0, (short) b.length);
ecPrv.setG(G, (short) 0, (short) G.length);
ecPrv.setR(r, (short) 0, (short) r.length);
ecPub.setFieldFP(p, (short) 0, (short) p.length);
ecPub.setA(a, (short) 0, (short) a.length);
ecPub.setB(b, (short) 0, (short) b.length);
ecPub.setG(G, (short) 0, (short) G.length);
ecPub.setR(r, (short) 0, (short) r.length);
return kp;
}
}
In the applet I have the following code:
private MyApplet(byte[] bArray, short bOffset, byte bLength) {
ecKeyPair = Curve25519.newKeyPair();
ecKeyPair.genKeyPair();
register();
}
public static void install(byte[] bArray, short bOffset, byte bLength) {
new MyApplet(bArray, bOffset, bLength);
}
When I try to install it on the javacard using GPP I get the following exception:
pro.javacard.gp.GPException: Install for Install and make selectable failed SW: 6F00
at pro.javacard.gp.GlobalPlatform.check(GlobalPlatform.java:1092)
at pro.javacard.gp.GlobalPlatform.installAndMakeSelectable(GlobalPlatform.java:798
)
at pro.javacard.gp.GPTool.main(GPTool.java:478)
Can I use Curve25519 keypairs for ECDSA javacard signing?
Not quite. Montgomery and Weierstrass forms can be converted into each other: http://samuelkerr.com/?p=431
However, there are various caveats getting this to work on Javacards, and part of the curve operations / conversion has to be done on a PC talking to the card. I'm currently working on this and am happy to share the code once it's actually done.
UPDATE: I uploaded the respective code here: https://github.com/david-oswald/jc_curve25519
No, such curves are not directly supported.
All Java Card Elliptic Curve facilities use the Weierstraß equation which is
y^2 = x^3 + a*x + b mod p
Curve 25519 is based on
y^2 = x^3 + 486662*x^2 + x mod p
Unfortunately its not possible to directly support such Montgomery curves.

Resources