Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
projekte:epson-stylus-sx100 [2016-06-04 17:54] – cracki | projekte:epson-stylus-sx100 [2016-06-04 18:43] – [Arduino] cracki | ||
---|---|---|---|
Line 83: | Line 83: | ||
* warte, 0-20 Millisekunden haben geklappt | * warte, 0-20 Millisekunden haben geklappt | ||
+ | ==== Arduino ==== | ||
+ | |||
+ | < | ||
+ | #define START 2 | ||
+ | #define CLOCK 3 | ||
+ | #define DPIMODE 4 | ||
+ | |||
+ | bool dpimode = 1; | ||
+ | uint16_t pixels = dpimode ? 5184 : 2592; | ||
+ | |||
+ | uint32_t linetime = 20000; // us | ||
+ | uint32_t sched = 0; | ||
+ | |||
+ | void setup() { | ||
+ | pinMode(START, | ||
+ | pinMode(CLOCK, | ||
+ | pinMode(DPIMODE, | ||
+ | |||
+ | digitalWrite(DPIMODE, | ||
+ | |||
+ | sched = micros(); | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | digitalWrite(START, | ||
+ | digitalWrite(CLOCK, | ||
+ | digitalWrite(CLOCK, | ||
+ | digitalWrite(START, | ||
+ | |||
+ | for (uint16_t counter = 0; counter < 82 + pixels; counter += 1) | ||
+ | { | ||
+ | PORTD |= _BV(PORTD3); | ||
+ | // | ||
+ | PORTD &= ~_BV(PORTD3); | ||
+ | // | ||
+ | } | ||
+ | |||
+ | sched += linetime; | ||
+ | int32_t dt = sched - micros(); | ||
+ | while (dt > 0x4000) | ||
+ | { | ||
+ | delayMicroseconds(0x4000); | ||
+ | dt -= 0x4000; | ||
+ | } | ||
+ | if (dt > 0) | ||
+ | delayMicroseconds(dt); | ||
+ | } | ||
+ | </ | ||
==== coloring code ==== | ==== coloring code ==== | ||
< | < |