mirror of
https://github.com/geekammo/MicroView-Arduino-Library.git
synced 2026-02-19 19:11:22 +01:00
added Sine Wave Example
This commit is contained in:
@@ -91,6 +91,10 @@ void loop() {
|
||||
</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
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
60
examples/MicroViewSineWave/MicroViewSineWave.ino
Normal file
60
examples/MicroViewSineWave/MicroViewSineWave.ino
Normal 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);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user