LCD Pixel sequence error
code: [select]
#include "spi.h"
#include "ili9341_due_config.h"
#include "ili9341_due.h"
#include "info.h"
#include "close.h"
#include "arduino.h"
#include "fonts\systemfont5x7.h" // system font
#include "fonts\arial14.h" // proportional font
#include "fonts\arial_bold_14.h" // bold proportional font
#include "fonts\corsiva_12.h"
#include "fonts\verdana_digits_24.h" // large proportional font - numerals
#include "fonts\fixednums7x15.h" // fixed width font - numerals
#include "fonts\fixednums8x16.h" // fixed width font - numerals
#include "fonts\fixednums15x31.h" // fixed width font - numerals
#include "fonts\helvneueth70.h"
#include "fonts\jokerman_255.h"
#include "fonts\roboto16.h"
#include "fonts\roboto32.h"
#include "fonts\roboto70nums.h"
#define lcd_cs 10 // chip select lcd
#define lcd_dc 9 // command/data lcd
#define lcd_rst 8 // reset lcd
byte pixelarray[128];
byte pixelarrai[128];
int clk = 22;
int si = 13;
int i = 0;
int j = 0;
uint32_t sensorvalue = 0;
int = 0;
ili9341_due tft(lcd_cs, lcd_dc, lcd_rst);
void drawlinebyangle(int16_t x, int16_t y, int16_t angle, uint16_t start, uint16_t length, uint16_t color);
void drawline(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
void setup()
{
// spi.begin();
// spi.setclockdivider(spi_clock_div128);
serial.begin(500000);
pinmode(clk, output);
pinmode(si, output);
digitalwrite(si, high);
digitalwrite(clk, high);
digitalwrite(si, low);
digitalwrite(clk, low);
for(i = 0; < 128; ++)
{
clockpulse();
}
tft.begin();
tft.setrotation(ilirotation0); // landscape
// tft.drawimage(intro, 0, 0, introwidth, introheight);
// delay(2500);
tft.fillscreen(ili9341_darkblue);
//tft.setspiclockdivider(2);
//tft.fillrect(129, 0, 191, 240, ili9341_black);
//tft.fillrect(130, 1, 189, 20, tft.color565(0,0,50));
}
void clockpulse()
{
delaymicroseconds(0.001);
digitalwrite(clk, high);
delaymicroseconds(0.001);
digitalwrite(clk, low);
}
void loop()
{
image();
}
void image()
{
a++;
if(a == 320)
{
= 0;
}
digitalwrite(si, high);
digitalwrite(clk, high);
digitalwrite(si, low);
digitalwrite(clk, low);
for(i = 0; < 128; i++)
{
delaymicroseconds(0.001);
pixelarray[i] = analogread(a0) ;
pixelarrai[i] = analogread(a5) ;
clockpulse();
}
for(i = 0; < 120; i++)
{
tft.drawpixel(i, a, tft.color565(pixelarray[i],pixelarray[i],pixelarray[i]));
}
for(j = 120; j < 240; j++)
{
tft.drawpixel(j, a, tft.color565(pixelarrai[i],pixelarrai[i],pixelarrai[i]));
}
}
what problem ? not aligned after 120 pixels
quote
what problem ?no code tags.
Arduino Forum > Using Arduino > Programming Questions > LCD Pixel sequence error
arduino
Comments
Post a Comment