Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*****************************************************
- * TITLE : Read ADC from Analog 0 and Show Bargraph
- * CATAGORIES : IPST/GLCD
- * CREATED DATE : SEPTEMBER 13, 2017
- * AUTHOR : KRITSADA JAIYEN
- * WEBSITE : HTTP://WWW.INEX.CO.TH
- * MCU : IPST-SE
- * Thai DESCRIPTION : อ่านค่าจากช่องอะนาลอกช่อง 0
- * ในช่วง 0-160 นำค่าแสดงผลที่หน้าจอแนวนอน
- * นำผลที่ได้แสดงเป็นกราฟแท่งด้วย
- ******************************************************/
- #include <ipst.h> // include file for IPST-SE
- int x;
- void setup(){
- glcdMode(1);
- setTextSize(3);
- }
- void loop(){
- x = map(analog(0),0,1023,0,160);
- glcd(1,0,"%d ",x);
- glcdFillRect(0,80,x,10,GLCD_RED);
- glcdFillRect(x,80,160-x,10,GLCD_BLACK);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement