Is there way to play a video on the VEX5 robot brain ?
You can display GIF images on the brain, and using LVGL I’m sure there’s a way to make a video player.
3 Likes
Was that a 28 second video on the brain?
so that was an 8 second clip from something I found on vimeo.
I converted that into an image sequence. placed the frames on an SD Card and then wrote a small program (just a hack, the code is not pretty ) to play the frames. They were read into memory first.
fireplace demo
//
// main.cpp
//
// Created by <user> on Mon Dec 24 2018.
// Copyright (C) 2018 <team>. All rights reserved.
//
#include <stdio.h>
#include "v5.h"
#include "v5_vcs.h"
using namespace vex;
brain Brain;
uint8_t imageBuffer[ 240 * (128 * 1024) ];
uint32_t imageBufferLen[240];
void
fireplaceInit() {
char filename[32];
Brain.Screen.clearScreen();
for(int file=0;file<240;file++) {
int offset = file * (128 * 1024);
sprintf(filename,"images/fire_%05d.png", file );
imageBufferLen[file] = Brain.SDcard.loadfile( filename, &imageBuffer[offset], 128 * 1024 );
Brain.Screen.printAt( 10, 20, "Loading.. %3d", file );
}
}
void
fireplace() {
int file = 0;
char banner[] = "Happy Holidays 2018";
int pos1 = 480;
int pos2 = 960;
fireplaceInit();
Brain.Screen.setFont( fontType::prop40 );
Brain.Screen.setPenColor( color::red );
while(1) {
Brain.Screen.clearScreen();
int offset = file * (128 * 1024);
Brain.Screen.drawImageFromBuffer(&imageBuffer[offset], 0, 0, imageBufferLen[file]);
Brain.Screen.setPenColor( color::red );
Brain.Screen.printAt( pos1, 40, false, banner);
Brain.Screen.setPenColor( color::green );
Brain.Screen.printAt( pos2, 40, false, banner);
Brain.Screen.render();
file ++;
if(file == 239 )
file = 3;
pos1-=4;
if( pos1 < -480 )
pos1 = 480;
pos2-=4;
if( pos2 < -480 )
pos2 = 480;
}
}
int main() {
int count = 0;
fireplace();
while(1) {
Brain.Screen.printAt( 10, 50, "Hello %d", count++ );
// Allow other tasks to run
this_thread::sleep_for(10);
}
}
4 Likes
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.