Compare commits
No commits in common. "baef14fe26909f53c11143a1acb59eda39085cdc" and "aeed86ec095d171616fc86675fee16a6f6221c6a" have entirely different histories.
baef14fe26
...
aeed86ec09
1 changed files with 15 additions and 17 deletions
|
|
@ -2,30 +2,28 @@
|
||||||
#include <SPI.h> //for screen
|
#include <SPI.h> //for screen
|
||||||
#include <U8g2lib.h> //for screen
|
#include <U8g2lib.h> //for screen
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define ADC_PIN 26
|
|
||||||
|
|
||||||
int adcVal = 0;
|
|
||||||
float xLocation = 0;
|
|
||||||
|
|
||||||
//screen setup
|
//screen setup
|
||||||
U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R2, 17, 20, 21);
|
U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R2, 17, 20, 21);
|
||||||
//uint8_t *buf;
|
uint8_t *buf;
|
||||||
char outString[99];
|
char outString[99];
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
//setup screen
|
//Screen setup
|
||||||
u8g2.begin();
|
buf = (uint8_t *)malloc(u8g2.getBufferSize());
|
||||||
|
u8g2.setBufferPtr(buf);
|
||||||
|
u8g2.initDisplay();
|
||||||
|
u8g2.clearDisplay();
|
||||||
|
u8g2.setPowerSave(0);
|
||||||
u8g2.setFont(u8g2_font_ncenB14_tr);
|
u8g2.setFont(u8g2_font_ncenB14_tr);
|
||||||
//setup ADC
|
|
||||||
analogReadResolution(10);
|
u8g2.clearBuffer();
|
||||||
digitalWriteFast(23, 1);
|
sprintf(outString,"helloworld");
|
||||||
|
u8g2.drawStr(7,35,outString);
|
||||||
|
u8g2.sendBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
adcVal = analogRead(ADC_PIN);
|
// put your main code here, to run repeatedly:
|
||||||
xLocation = (((float)adcVal/1024)*100);
|
|
||||||
u8g2.clearBuffer();
|
|
||||||
sprintf(outString, "helloworld");
|
|
||||||
u8g2.drawStr(xLocation, 35, outString);
|
|
||||||
u8g2.sendBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue