Store › Forums › Video Experimenter › General Discussion › Overlaying static text but moving vertically
- This topic has 7 replies, 2 voices, and was last updated 7 years, 5 months ago by Michael.
-
AuthorPosts
-
May 31, 2017 at 3:59 pm #9048zhengys18Participant
I am trying to overlay the time on a fixed position on the video stream (0,0), however, the output of the video stream has the text but moving vertical along the same line all the time. Anybody encounter the same question?
May 31, 2017 at 6:47 pm #9049MichaelKeymasterCan you post your code so we can have a look?
May 31, 2017 at 7:56 pm #9050zhengys18Participant#include <TVout.h>
#include <fontALL.h>#define W 128
#define H 72TVout tv;
unsigned char x,y;
unsigned char originx = 5;
unsigned char originy = 80;
unsigned char plotx = originx;
unsigned char ploty = 40;
char s[64];
unsigned int n = 0;
int index = 0;
int messageLen = 32;
char message[] = “…OVERLAY TEXT AND GRAPHICS ON A VIDEO SIGNAL…OVERLAY TEXT AND GRAPHICS ON A VIDEO SIGNAL”;
char saveChar;
float t=0;unsigned long time1;
unsigned long time2;void setup() {
tv.begin(NTSC, W, H);
initOverlay();
tv.select_font(font4x6);
tv.fill(0);
Serial.begin(9600);
t=0;
}
// Initialize ATMega registers for video overlay capability.
// Must be called after tv.begin().
void initOverlay() {
TCCR1A = 0;
// Enable timer1. ICES0 is set to 0 for falling edge detection on input capture pin.
TCCR1B = _BV(CS10);// Enable input capture interrupt
TIMSK1 |= _BV(ICIE1);// Enable external interrupt INT0 on pin 2 with falling edge.
EIMSK = _BV(INT0);
EICRA = _BV(ISC01);
}// Required to reset the scan line when the vertical sync occurs
ISR(INT0_vect) {
display.scanLine = 0;
}void loop() {
time1 = millis();
tv.delay_frame(1);
int int_t=int(t*1000);
sprintf(s, “%d”,int_t);t=t+0.001;
tv.fill(0);
tv.print(0, 0, s);
//tv.draw_line(-10,0,W,0,1);
//tv.draw_line(-10,0,0,H,1);time2 = millis();
delay(50-(time2-time1));
}I also use the code here: http://nootropicdesign.com/projectlab/2011/03/20/text-and-graphics-overlay/
but the number still is moving vertically.May 31, 2017 at 8:06 pm #9051MichaelKeymasterHmm, the timing is off. Did you buy an assembled Video Experimenter or a kit that you assembled?
I’d check to make sure you have a good connection on digital pin 2. That is the vertical sync.
Also, you might try another video source and another video display.June 1, 2017 at 12:04 am #9052zhengys18ParticipantI buy the assembled one. I configured the digital pin 2 using the same Arduino before, will it cause any problem? If so, how can I reset to its original state?
June 1, 2017 at 12:19 am #9053zhengys18ParticipantAlso, currently I only have 1 wire connected to the video input,1 wire to the gnd and use RCA video output. Do I need to connect anything to D2?
June 1, 2017 at 12:47 am #9054zhengys18ParticipantOk. Problem solved. Previously I configured pin2 as output using pinmode. Seems like then the interrupt is detached. I reattached the interrupt and now it is working. Thanks a lot.
A following question is that is there any way to put text on the corner of the video? I set it to (0,0) and it is not using the whole screen.
June 1, 2017 at 7:58 am #9055MichaelKeymasterThe viewport may not take up the entire screen on some screens. You can adjust the top edge by changing this value:
display.output_delay = 130;
Try values between 130 and 200 to see the difference.
To change the left edge, change this value:
display.start_render = 10;
Try values between 10 and 70 to see how the left edge changes.
This may help you move the entire viewport up to the upper left corner… -
AuthorPosts
- You must be logged in to reply to this topic.