7 Commits

Author SHA1 Message Date
JP Liew
b577e9e538 fixed tab spaces 2014-06-26 21:40:36 +10:00
JP Liew
ff388744a6 added more documentation 2014-06-26 21:20:49 +10:00
JP Liew
a7e091c2f9 added comments to support doxygen 2014-06-26 14:38:16 +10:00
JP
91f965f1eb added Sine Wave Example 2014-06-13 12:41:44 +10:00
JP
3c5c44fe31 removed 12x24Font.h that was used for tutorial 2014-06-12 14:48:46 +10:00
JP
90f8e8d606 added Rotating Cube example by Jim Lindblom 2014-06-12 11:17:32 +10:00
JP
73cf96e723 added SparkFun logo 2014-06-09 11:20:56 +10:00
7 changed files with 1224 additions and 760 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -110,11 +110,13 @@ public:
MicroView(void) {};
void begin(void);
#if ARDUINO >= 100
//#if ARDUINO >= 100
virtual size_t write(uint8_t);
#else
virtual void write(uint8_t);
#endif
//#else
// virtual void write(uint8_t);
//#endif
// RAW LCD functions
void command(uint8_t c);
@@ -202,7 +204,9 @@ public:
void setMaxValue(int16_t max);
void setMinValue(int16_t max);
void setValue(int16_t val);
virtual void draw(){};
/** \brief Draw widget value overridden by child class. */
virtual void draw(){};
/** \brief Draw widget face overridden by child class. */
virtual void drawFace(){};
private:
@@ -257,6 +261,7 @@ private:
class MVSPIClass {
public:
/** \brief Transfer data byte via SPI port. */
inline static byte transfer(byte _data);
// SPI Configuration methods
@@ -291,4 +296,4 @@ void MVSPIClass::detachInterrupt() {
extern MicroView uView;
#endif
#endif

View File

@@ -16,7 +16,7 @@ Arduino library for MicroView.
2. cd libraries
3. mkdir MicroView
4. cd MicroView
5. git clone git@github.com:geekammo/microview.git .
5. git clone https://github.com/geekammo/MicroView-Arduino-Library.git .
6. Start Arduino IDE.
7. MicroView example is located at, File--->Example--->MicroView--->MicroViewDemo
@@ -25,12 +25,12 @@ Arduino library for MicroView.
#include <MicroView.h>
void setup() {
uView.begin();
uView.begin();
}
void loop() {
uView.print("HelloWorld");
uView.display(); // display current page buffer
uView.print("HelloWorld");
uView.display(); // display current page buffer
}
</code></pre>
@@ -39,18 +39,18 @@ void loop() {
#include &lt;MicroView.h&gt;
void setup() {
uView.begin();
uView.clear(PAGE); // clear the page buffer
uView.begin();
uView.clear(PAGE); // clear the page buffer
}
void loop() {
uView.line(0,0,64,48);
uView.circle(32,24,10);
uView.rect(10,10,20,20);
uView.pixel(50,5);
uView.setCursor(0,40);
uView.print(" MicroView");
uView.display(); // display current page buffer
uView.line(0,0,64,48);
uView.circle(32,24,10);
uView.rect(10,10,20,20);
uView.pixel(50,5);
uView.setCursor(0,40);
uView.print(" MicroView");
uView.display(); // display current page buffer
}
</code></pre>
@@ -61,18 +61,18 @@ void loop() {
MicroViewWidget *widget,*widget2;
void setup() {
uView.begin();
uView.clear(PAGE);
widget= new MicroViewGauge(32,30,0,100); // draw Gauge widget at x=32,y=30,min=0, max=100
widget2= new MicroViewSlider(0,0,0,100); // draw Slider widget at x=0,y=0,min=0, max=100
uView.begin();
uView.clear(PAGE);
widget= new MicroViewGauge(32,30,0,100); // draw Gauge widget at x=32,y=30,min=0, max=100
widget2= new MicroViewSlider(0,0,0,100); // draw Slider widget at x=0,y=0,min=0, max=100
}
void loop() {
for(int i=0; i&lt;=100;i++) {
widget->setValue(i); // give a value to widget
widget2->setValue(i);
uView.display(); // display current page buffer
}
for(int i=0; i&lt;=100;i++) {
widget->setValue(i); // give a value to widget
widget2->setValue(i);
uView.display(); // display current page buffer
}
}
</code></pre>
@@ -81,19 +81,29 @@ void loop() {
#include &lt;MicroView.h&gt;
void setup() {
uView.begin();
uView.clear(PAGE);
uView.begin();
uView.clear(PAGE);
}
void loop() {
uView.checkComm();
uView.checkComm();
}
</code></pre>
## History
**v1.13b: 13th June 2014 by JP Liew**
* added Sine Wave Example
* inserted license to example code
**v1.12b: 11th June 2014 by JP Liew**
* added comments for SparkFun Logo
* added Rotating Cube example by Jim Lindblom @ SparkFun Electronics
* changed git clone instruction to use https
**v1.11b: 9th June 2014 by JP Liew**
* added simple tutorials for production sketch
* modified OLED RESET pin to 7
* added SparkFun Logo
**v1.10b: 22th April 2014 by JP Liew**
* changed SS, RESET, DC pins to use weak internal pull-up resistors
@@ -159,4 +169,4 @@ void loop() {
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.

View File

@@ -0,0 +1,88 @@
/******************************************************************************
MicroViewCube.ino
Rotating a 3-D Cube on the MicroView Display
Jim Lindblom @ SparkFun Electronics
Original Creation Date: June 9, 2014
This sketch uses the MicroView library to draw a 3-D projected
cube, and rotate it along all three axes.
Development environment specifics:
IDE: Arduino 1.0.5
Hardware Platform: MicroView
This code is beerware; if you see me (or any other SparkFun employee) at the
local, and you've found our code helpful, please buy us a round!
Distributed as-is; no warranty is given.
******************************************************************************/
#include <MicroView.h>
#define SHAPE_SIZE 600
#define ROTATION_SPEED 0 // ms delay between cube draws
int SCREEN_WIDTH = uView.getLCDWidth();
int SCREEN_HEIGHT = uView.getLCDHeight();
float d = 3;
float px[] = { -d, d, d, -d, -d, d, d, -d };
float py[] = { -d, -d, d, d, -d, -d, d, d };
float pz[] = { -d, -d, -d, -d, d, d, d, d };
float p2x[] = {0,0,0,0,0,0,0,0};
float p2y[] = {0,0,0,0,0,0,0,0};
float r[] = {0,0,0};
void setup()
{
uView.begin();
uView.clear(ALL);
uView.display();
}
void loop()
{
drawCube();
delay(ROTATION_SPEED);
}
void drawCube()
{
r[0]=r[0]+PI/180.0; // Add a degree
r[1]=r[1]+PI/180.0; // Add a degree
r[2]=r[2]+PI/180.0; // Add a degree
if (r[0] >= 360.0*PI/180.0) r[0] = 0;
if (r[1] >= 360.0*PI/180.0) r[1] = 0;
if (r[2] >= 360.0*PI/180.0) r[2] = 0;
for (int i=0;i<8;i++)
{
float px2 = px[i];
float py2 = cos(r[0])*py[i] - sin(r[0])*pz[i];
float pz2 = sin(r[0])*py[i] + cos(r[0])*pz[i];
float px3 = cos(r[1])*px2 + sin(r[1])*pz2;
float py3 = py2;
float pz3 = -sin(r[1])*px2 + cos(r[1])*pz2;
float ax = cos(r[2])*px3 - sin(r[2])*py3;
float ay = sin(r[2])*px3 + cos(r[2])*py3;
float az = pz3-150;
p2x[i] = SCREEN_WIDTH/2+ax*SHAPE_SIZE/az;
p2y[i] = SCREEN_HEIGHT/2+ay*SHAPE_SIZE/az;
}
uView.clear(PAGE);
for (int i=0;i<3;i++)
{
uView.line(p2x[i],p2y[i],p2x[i+1],p2y[i+1]);
uView.line(p2x[i+4],p2y[i+4],p2x[i+5],p2y[i+5]);
uView.line(p2x[i],p2y[i],p2x[i+4],p2y[i+4]);
}
uView.line(p2x[3],p2y[3],p2x[0],p2y[0]);
uView.line(p2x[7],p2y[7],p2x[4],p2y[4]);
uView.line(p2x[3],p2y[3],p2x[7],p2y[7]);
uView.display();
}

View File

@@ -1,3 +1,20 @@
/*
MicroView Arduino Library
Copyright (C) 2014 GeekAmmo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <MicroView.h>
#include <Time.h>
@@ -10,7 +27,7 @@ void setup() {
uView.clear(ALL); // erase hardware memory inside the OLED controller
uView.display(); // display the content in the buffer memory, by default it is the MicroView logo
setTime(10,10,01,17,1,2014);
delay(500);
delay(700);
uView.clear(PAGE); // erase the memory buffer, when next uView.display() is called, the OLED will be cleared.
}
@@ -341,7 +358,6 @@ void displayEnd() {
delay(onDelay);
}
void loop() {
int i;
static double counter=99999;
@@ -474,7 +490,6 @@ void loop() {
uView.display();
}
onDelay=5;
uView.setFontType(0);
uView.setCursor(0,40);
@@ -563,7 +578,7 @@ void loop() {
counter--;
uView.display();
mSec=millis()+100;
}ggggg
}
}
uView.clear(PAGE);

View File

@@ -0,0 +1,60 @@
/*
MicroView Sine Wave Example
Copyright (C) 2014 GeekAmmo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <MicroView.h>
void setup() {
uView.begin();
uView.clear(PAGE);
}
void loop () {
int i;
float rad,srad, x,y;
int amp=20;
int nPhase=360;
for(i=0; i<nPhase;i++) {
x=i;
x=x*0.017453;
y= sin(x);
y=y*amp; // amplitude
y=y+24;
x=(double)64/(double)nPhase;
x=x*i;
uView.pixel(x, y);
uView.display();
}
amp=10;
nPhase=3*360;
for(i=0; i<nPhase;i++) {
x=i;
x=x*0.017453;
y= cos(x);
y=y*amp; // amplitude
y=y+24;
x=(double)64/(double)nPhase;
x=x*i;
uView.pixel(x, y);
}
uView.display();
delay(1500);
uView.clear(PAGE);
}

View File

@@ -1,3 +1,20 @@
/*
MicroView Arduino Library
Copyright (C) 2014 GeekAmmo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <MicroView.h>
MicroViewWidget *widget[4]; // declaring an array of 4 MicroViewWidget