Advertisement
Guest User

half-frame

a guest
Dec 14th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. #include <TVout.h>
  2. #include <fontALL.h>
  3. #define W 128
  4. #define H 96
  5.  
  6. TVout tv;
  7. unsigned char x, y;
  8. unsigned char c;
  9. unsigned char minX, minY, maxX, maxY;
  10. char s[32];
  11. byte midX[96];
  12. long int t1, t2, dt;
  13.  
  14.  
  15. void setup() {
  16. tv.begin(PAL, W, H);
  17. initOverlay();
  18. initInputProcessing();
  19.  
  20. tv.select_font(font8x8);
  21. tv.fill(0);
  22. }
  23.  
  24.  
  25. void initOverlay() {
  26. TCCR1A = 0;
  27. // Enable timer1. ICES0 is set to 0 for falling edge detection on input capture pin.
  28. TCCR1B = _BV(CS10);
  29.  
  30. // Enable input capture interrupt
  31. TIMSK1 |= _BV(ICIE1);
  32.  
  33. // Enable external interrupt INT0 on pin 2 with falling edge.
  34. EIMSK = _BV(INT0);
  35. EICRA = _BV(ISC01);
  36. }
  37.  
  38. void initInputProcessing() {
  39. // Analog Comparator setup
  40. ADCSRA &= ~_BV(ADEN); // disable ADC
  41. ADCSRB |= _BV(ACME); // enable ADC multiplexer
  42. ADMUX &= ~_BV(MUX0); // select A2 for use as AIN1 (negative voltage of comparator)
  43. ADMUX |= _BV(MUX1);
  44. ADMUX &= ~_BV(MUX2);
  45. ACSR &= ~_BV(ACIE); // disable analog comparator interrupts
  46. ACSR &= ~_BV(ACIC); // disable analog comparator input capture
  47. }
  48.  
  49. // Required
  50. ISR(INT0_vect) {
  51. display.scanLine = 0;
  52. }
  53.  
  54.  
  55. void loop() {
  56. // t1 = tv.millis();
  57. tv.capture();
  58.  
  59. // uncomment if tracking dark objects
  60. // tv.fill(INVERT);
  61.  
  62.  
  63.  
  64. // draw bounding box
  65. tv.fill(2);
  66.  
  67. tv.draw_line(126, 95, 127, 0, 1);
  68. // tv.draw_line(125, 10, 5, 10, 1);
  69.  
  70. // tv.delay(21);
  71. // t2 = tv.millis();
  72. // tv.set_pixel(20,20,1);
  73. //tv.print(5, 5, 0);
  74. tv.resume();
  75. tv.delay_frame(2);
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement