Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Arduino code to picomite
Page 1 of 3 | |||||
Author | Message | ||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
can some please help me to convert the folloowing arduino code to picomite code static const unsigned char PROGMEM VUMeter[] = { 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x09, 0x04, 0x80, 0x21, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x98, 0x08, 0x06, 0x03, 0x80, 0x21, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0x10, 0x09, 0x00, 0x80, 0x21, 0x20, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0x10, 0x06, 0x03, 0x00, 0x20, 0xC0, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x80, 0xA4, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x40, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x40, 0x00, 0x00, 0x02, 0x01, 0x00, 0x40, 0x80, 0x07, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x42, 0x40, 0x00, 0x08, 0x02, 0x01, 0x08, 0x40, 0x80, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x79, 0x80, 0x04, 0x08, 0x02, 0x01, 0x08, 0x81, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x02, 0x01, 0x08, 0x81, 0x11, 0x04, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x02, 0x01, 0x08, 0x81, 0x21, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x84, 0x02, 0x04, 0x0F, 0xFF, 0xFF, 0xC3, 0xE2, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0xC2, 0x01, 0x07, 0xF0, 0x00, 0x00, 0x3B, 0xFE, 0x08, 0x40, 0x40, 0x08, 0x00, 0x00, 0xFE, 0x00, 0x62, 0x01, 0xF8, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xE8, 0x40, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x21, 0x1E, 0x00, 0x04, 0x00, 0x80, 0x00, 0x7F, 0xFE, 0x80, 0x80, 0x08, 0x00, 0x00, 0x00, 0x03, 0x31, 0xE0, 0x00, 0x04, 0x00, 0x80, 0x04, 0x01, 0xFF, 0xC1, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x1E, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x1F, 0xFA, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0xF0, 0x00, 0x40, 0x3B, 0x07, 0x60, 0x00, 0x00, 0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x34, 0x81, 0x90, 0xCC, 0xC0, 0x00, 0x3F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x03, 0x30, 0x0C, 0x82, 0x90, 0x53, 0x20, 0x00, 0x07, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x70, 0x40, 0x00, 0xC8, 0x3B, 0x02, 0x60, 0x53, 0x20, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x01, 0x80, 0x20, 0x01, 0xC8, 0x00, 0x00, 0x00, 0x4C, 0xC0, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, 0x06, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFC, 0x00, 0x00, 0x30, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xA0, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x02, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x06, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x8C, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x70, 0x19, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0F, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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 }; display.drawBitmap(0, 0, VUMeter, 128, 64, WHITE); |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4253 |
Looks like it is pixel data, 1 bit per pixel, for a 128x64 lcd display. It is just data that when written to a disply, produces a picture. Volhout PicomiteVGA PETSCII ROBOTS |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3815 |
Put it in a file and read it in? Or DATA statements. 0x00 can be 0 Other 0x.. can be &h.. John |
||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1110 |
Untested, but maybe this will display the image? dim integer bitpat cls restore for y = 0 to 63 for x = 0 to 15 ' 8 pixels per byte read read bitpat if bitpat = 999 then end ' unexpected end of data for b = 7 to 0 step -1 if bitpat AND 2^b then pixel x*8 + 7 - b, y, rgb(white) next b next x next y end data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h06,&h03,&h00,&h60,&hC0,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h78,&h09,&h04,&h80,&h21,&h20,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h01,&h98,&h08,&h06,&h03,&h80,&h21,&h20,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&hA4,&h10,&h09,&h00,&h80,&h21,&h20,&h07,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&hA4,&h10,&h06,&h03,&h00,&h20,&hC0,&h00,&h80,&h00,&h00,&h00 data &h00,&h00,&h71,&h80,&hA4,&h10,&h00,&h00,&h00,&h00,&h00,&h01,&h00,&h00,&h00,&h00 data &h00,&h00,&h0A,&h40,&h98,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h80,&h3C,&h00,&h00 data &h00,&h00,&h3A,&h40,&h00,&h00,&h02,&h01,&h00,&h40,&h80,&h07,&h00,&h20,&h00,&h00 data &h00,&h00,&h42,&h40,&h00,&h08,&h02,&h01,&h08,&h40,&h80,&h00,&h00,&h38,&h00,&h00 data &h00,&h00,&h79,&h80,&h04,&h08,&h02,&h01,&h08,&h81,&h10,&h00,&h00,&h04,&h00,&h00 data &h00,&h00,&h00,&h00,&h04,&h08,&h02,&h01,&h08,&h81,&h11,&h04,&h00,&h38,&h00,&h00 data &h00,&h00,&h00,&h00,&h02,&h04,&h02,&h01,&h08,&h81,&h21,&h04,&h00,&h00,&h08,&h00 data &h00,&h00,&h00,&h84,&h02,&h04,&h0F,&hFF,&hFF,&hC3,&hE2,&h04,&h00,&h00,&h08,&h00 data &h00,&h00,&h00,&hC2,&h01,&h07,&hF0,&h00,&h00,&h3B,&hFE,&h08,&h40,&h40,&h08,&h00 data &h00,&hFE,&h00,&h62,&h01,&hF8,&h00,&h00,&h00,&h03,&hFF,&hE8,&h40,&h80,&h7F,&h00 data &h00,&h00,&h00,&h21,&h1E,&h00,&h04,&h00,&h80,&h00,&h7F,&hFE,&h80,&h80,&h08,&h00 data &h00,&h00,&h03,&h31,&hE0,&h00,&h04,&h00,&h80,&h04,&h01,&hFF,&hC1,&h00,&h08,&h00 data &h00,&h00,&h07,&h1E,&h00,&h40,&h00,&h00,&h00,&h04,&h00,&h1F,&hFA,&h00,&h08,&h00 data &h00,&h00,&h07,&hF0,&h00,&h40,&h3B,&h07,&h60,&h00,&h00,&h01,&hFF,&h00,&h00,&h00 data &h00,&h00,&h03,&h80,&h00,&h00,&h34,&h81,&h90,&hCC,&hC0,&h00,&h3F,&hC0,&h00,&h00 data &h00,&h00,&h0C,&h00,&h03,&h30,&h0C,&h82,&h90,&h53,&h20,&h00,&h07,&hF8,&h00,&h00 data &h00,&h00,&h70,&h40,&h00,&hC8,&h3B,&h02,&h60,&h53,&h20,&h00,&h00,&hFE,&h00,&h00 data &h00,&h01,&h80,&h20,&h01,&hC8,&h00,&h00,&h00,&h4C,&hC0,&h00,&h00,&h3F,&h80,&h00 data &h00,&h06,&h00,&h00,&h03,&h30,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h07,&hE0,&h00 data &h00,&h08,&h00,&h0C,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h01,&hFC,&h00 data &h00,&h30,&h00,&h12,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h78,&h00 data &h00,&h00,&h40,&h12,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h10,&h00 data &h00,&h00,&hA0,&h0C,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h44,&h00,&h00,&h00,&h02,&h02,&h30,&hC0,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h08,&h00,&h00,&h00,&h03,&h06,&h30,&hC0,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h10,&h00,&h00,&h00,&h01,&h8C,&h30,&hC0,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h22,&h00,&h00,&h00,&h00,&hD8,&h30,&hC0,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h05,&h00,&h00,&h00,&h00,&h70,&h19,&h80,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h02,&h00,&h00,&h00,&h00,&h20,&h0F,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00 data 9999 Visit Vegipete's *Mite Library for cool programs. |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2140 |
Yes it does. |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
Thank you .. I will give it a go. |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
Now I have tried it... It is just to slow... would a bitmap be faster |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6812 |
Perhaps you could use BLIT so that you load it once then copy it into a memory buffer. Then you can BLIT it back very fast. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
Can you give me an example of how etc.. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6812 |
First, I don't know what display you are using. Not all displays support BLIT. Supported displays are VGA SSD1963 ILI9341 ILI9488 (if MISO connected) ST7789_320 You'll have to read the manual too, as I have very little experience with graphics. This should be easy enough though. BLIT READ b,x,y,w,h works with buffer number b It copies the displayed block starting at x,y that is w pixels wide and h pixels high BLIT WRITE b,x,y works with buffer number b It copies the block stored in buffer b to display co-ordinates x,y BLIT CLOSE b destroys buffer b and reclaims the memory. You can have up to 8 buffers (1-8). Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3815 |
Or make it a file (e.g. bmp)? I expect faster than the nested loops doing pixel-at-a-time. John |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6812 |
That would make it much faster loading initially, but I suspect that the eventual idea is to produce a display with a moving pointer (why else would a picture of a VU meter be wanted?). In that case you'd probably want to blit the image back and redraw the pointer in a new position during each frame blanking period to avoid flicker. I'm only guessing, as there's no details to go on. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
Yes. Mixtel90 your are absolutely correct. I found an Arduino version on the web and i am wanting to do this on the picomite. It was just that I didn't understand how the arduino PROGMEM worked and thanks for that. here is the complete Arduino code. #include <Wire.h> // requried to run I2C SH1106 #include <SPI.h> // requried to run I2C SH1106 #include <Adafruit_GFX.h> // https://github.com/adafruit/Adafruit-GFX-Library #include <Adafruit_SH1106.h> // https://github.com/wonho-maker/Adafruit_SH1106 #define OLED_RESET 4 // reset required for SH1106 Adafruit_SH1106 displayLeft(OLED_RESET); // reset required for SH1106 Adafruit_SH1106 displayRight(OLED_RESET); // reset required for SH1106 int left = A0; // analog input for outside audio source int right = A1; int hMeter = 65; // horizontal center for needle animation int vMeter = 85; // vertical center for needle animation (outside of dislay limits) int rMeter = 80; // length of needle animation or arch of needle travel float MeterValueLeft; float MeterValueRight; const int sampleWindow = 5; // sample window width in mS (50 mS = 20Hz) unsigned int sampleLeft; unsigned int sampleRight; unsigned int PeakLeft = 400; unsigned int PeakRight = 400; unsigned int fallTimeLeft; unsigned int fallTimeRight; int static_variable = 0; // VU meter background mask image: static const unsigned char PROGMEM VUMeter[] = { 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x09, 0x04, 0x80, 0x21, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x98, 0x08, 0x06, 0x03, 0x80, 0x21, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0x10, 0x09, 0x00, 0x80, 0x21, 0x20, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0x10, 0x06, 0x03, 0x00, 0x20, 0xC0, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x80, 0xA4, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x40, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x40, 0x00, 0x00, 0x02, 0x01, 0x00, 0x40, 0x80, 0x07, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x42, 0x40, 0x00, 0x08, 0x02, 0x01, 0x08, 0x40, 0x80, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x79, 0x80, 0x04, 0x08, 0x02, 0x01, 0x08, 0x81, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x02, 0x01, 0x08, 0x81, 0x11, 0x04, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x02, 0x01, 0x08, 0x81, 0x21, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x84, 0x02, 0x04, 0x0F, 0xFF, 0xFF, 0xC3, 0xE2, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0xC2, 0x01, 0x07, 0xF0, 0x00, 0x00, 0x3B, 0xFE, 0x08, 0x40, 0x40, 0x08, 0x00, 0x00, 0xFE, 0x00, 0x62, 0x01, 0xF8, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xE8, 0x40, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x21, 0x1E, 0x00, 0x04, 0x00, 0x80, 0x00, 0x7F, 0xFE, 0x80, 0x80, 0x08, 0x00, 0x00, 0x00, 0x03, 0x31, 0xE0, 0x00, 0x04, 0x00, 0x80, 0x04, 0x01, 0xFF, 0xC1, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x1E, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x1F, 0xFA, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0xF0, 0x00, 0x40, 0x3B, 0x07, 0x60, 0x00, 0x00, 0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x34, 0x81, 0x90, 0xCC, 0xC0, 0x00, 0x3F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x03, 0x30, 0x0C, 0x82, 0x90, 0x53, 0x20, 0x00, 0x07, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x70, 0x40, 0x00, 0xC8, 0x3B, 0x02, 0x60, 0x53, 0x20, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x01, 0x80, 0x20, 0x01, 0xC8, 0x00, 0x00, 0x00, 0x4C, 0xC0, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, 0x06, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFC, 0x00, 0x00, 0x30, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xA0, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x02, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x06, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x8C, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x70, 0x19, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0F, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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(){ pinMode(left, INPUT); pinMode (right, INPUT); // analog input for outside audio source displayLeft.begin(SH1106_SWITCHCAPVCC, 0x3C); // needed for SH1106 display displayLeft.clearDisplay(); displayRight.begin(SH1106_SWITCHCAPVCC, 0x3D); // needed for SH1106 display displayRight.clearDisplay(); Serial.begin(115200); // clears display from any library info displayed } void loop(){ unsigned long startMillis = millis(); // start of sample window unsigned int PeaktoPeakLeft = 0; // peak-to-peak level unsigned int SignalMaxLeft = 0; unsigned int SignalMinLeft = 1024; unsigned int PeaktoPeakRight = 0; // peak-to-peak level unsigned int SignalMaxRight = 0; unsigned int SignalMinRight = 1024; while ( millis() - startMillis < sampleWindow ){ sampleLeft = analogRead(left); sampleRight = analogRead(right); if (sampleLeft < 1024) { if (sampleLeft > SignalMaxLeft){ SignalMaxLeft = sampleLeft; // saves just the max levels } else if (sampleLeft < SignalMinLeft){ SignalMinLeft = sampleLeft; // saves just the min levels } } if (sampleRight < 1024) { if (sampleRight > SignalMaxRight){ SignalMaxRight = sampleRight; // saves just the max levels } else if (sampleRight < SignalMinRight){ SignalMinRight = sampleRight; // saves just the min levels } } } PeaktoPeakLeft = SignalMaxLeft - SignalMinLeft; // max - min = peak-peak amplitude PeaktoPeakRight = SignalMaxRight - SignalMinRight; // max - min = peak-peak amplitude if (PeaktoPeakLeft > PeakLeft){ PeakLeft = PeaktoPeakLeft;// saves just the min levels }else if(PeaktoPeakLeft < PeakLeft){ fallTimeLeft = ((PeakLeft - PeaktoPeakLeft) / 2); PeakLeft = PeakLeft-fallTimeLeft; } if (PeaktoPeakRight > PeakRight){ PeakRight = PeaktoPeakRight;// saves just the min levels }else if(PeaktoPeakRight < PeakRight){ fallTimeRight = ((PeakRight - PeaktoPeakRight) / 2); PeakRight = PeakRight-fallTimeRight; } MeterValueLeft = PeakLeft / 6; // convert volts to arrow information MeterValueRight = PeakRight / 6; // convert volts to arrow information drawleft(); drawright(); } /**************************************************** End of code taken from Adafruit Sound Level Sketch *****************************************************/ void drawleft(){ MeterValueLeft = MeterValueLeft - 34; // shifts needle to zero position displayLeft.clearDisplay(); // refresh display for next step displayLeft.drawBitmap(0, 0, VUMeter, 128, 64, WHITE); // draws background int a1 = (hMeter + (sin(MeterValueLeft / 57.296) * rMeter)); // meter needle horizontal coordinate int a2 = (vMeter - (cos(MeterValueLeft / 57.296) * rMeter)); // meter needle vertical coordinate displayLeft.drawLine(a1, a2, hMeter, vMeter, WHITE); // draws needle displayLeft.display(); } void drawright(){ MeterValueRight = MeterValueRight - 34; // shifts needle to zero position displayRight.clearDisplay(); // refresh display for next step displayRight.drawBitmap(0, 0, VUMeter, 128, 64, WHITE); // draws background int a1 = (hMeter + (sin(MeterValueRight / 57.296) * rMeter)); // meter needle horizontal coordinate int a2 = (vMeter - (cos(MeterValueRight / 57.296) * rMeter)); // meter needle vertical coordinate displayRight.drawLine(a1, a2, hMeter, vMeter, WHITE); // draws needle displayRight.display(); } I am wanting to do this on an ILI9341 and put both channels on the display at once side by side. Edited 2023-04-22 07:21 by asknik2022 |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6812 |
Sorry, Arduino code may as well be Martian hieroglyphics to me. I'd try what I suggested. Start by writing a routine to draw a pointer that follows the arc of the scale. You want its end position to be in a variable that makes some sort of sense to you, say 0-100. Write a loop that puts values into the register and run it to try to get the pointer moving as expected. Don't bother about image flicker, jus BLIT the image onto the screen and draw the pointer. It may look horrible. Once you have it working you can synchronise it with the frame flyback period so that the meter changes during the "dead" time of the display. As to how the VU meter maths works, don't ask me. I'm no programmer. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3815 |
Arduino PROGMEM just means put it in flash. (Partly because many of their boards have tiny RAM.) John |
||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1110 |
You could try turning it into a single character in a custom font. Visit Vegipete's *Mite Library for cool programs. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6812 |
Will SAVE IMAGE BITMAP convert it or is that only for saving a complete image from a LCD display? Something I've never used. Perhaps that could be used then the resulting BMP cropped on a PC. @asknik2022 Which display are you using? It would help us if we knew. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2140 |
SAVE IMAGE file$ [,x, y, w, h] - If the display is SPI and has SDO connected to MISO **. Also works on PicoVGA and MMB4W. Run @vegipete's program then:- SAVE IMAGE "VU_Meter.BMP", 0, 0, 128, 64 That is where the above pic came from. That can then be loaded to a sprite when the program runs. On recent Pico RCx versions no screen is needed, the image can go to a frame buffer and be saved. SAVE COMPRESSED IMAGE "VU_Meter.BMP", 0, 0, 128, 64 ** For ILI9488 a direct connection won't work, see the threads on how to connect. Edited 2023-04-22 23:02 by phil99 |
||||
asknik2022 Regular Member Joined: 26/03/2022 Location: United KingdomPosts: 92 |
I will be using an ILI9341 and not sure if MISO is connected |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6812 |
The ILI9341 is almost always ok. I say "almost" because there have been occasional cases in the past when Chinese sellers have sent ILI9488 instead - lots of confusion. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Page 1 of 3 |
Print this page |