I have a program which works on Nano Old Bootloader. I brought a new Nano which is Nano V3.1.
Same program i'm writing with New Bootloader option. It writes successfully. But doesn't came output on after connection. What is the problem?
Please post a simple sketch that illustrates the problem, using code tags when you do
Many people, including me, will not have the hardware and libraries to test the sketch which is why I asked for a simple sketch and I did ask you to post it here rather than attaching it
What exactly is the problem ?
What output are you expecting ?
What is dmd ?
I assume that you have thoroughly checked all of the connections
Good idea to also provide the forum with a schematic of your connections.
DMD is Dot Matrix Display. Basically P10 display. I am using DMD2 Library.
I attached both picture of Arduino. I have both new or old Arduino.
Old Version is Giving Display and New Version Doesn't show display. This is a GPS Clock.
// Inserting File Library
#include <SPI.h>
#include <DMD2.h>
#include <NMEAGPS.h>
#include <fonts/Arnr17.h>
// PICK ONE OF THESE PORT ALTERNATIVES
//
// BEST: connect GPS to pins 0 & 1, since you're not using Serial.
// Requires disconnecting pin 0 to upload new sketch over USB.
#define gpsPort Serial // just an alias for Serial
// 2nd BEST: connect GPS to pins 8 & 9 (on an UNO)
//#include <AltSoftSerial.h>
//AltSoftSerial gpsPort
// 3rd BEST:
//#include <NeoSWSerial.h>
//NeoSWSerial gpsPort(3, 4); // RX, TX
// WORST: SoftwareSerial NOT RECOMMENDED
// Defining Constants
#define Length 2
#define Width 1
// Declaration Variable
SoftDMD dmd(Length, Width); // Length x Width
NMEAGPS gps; // parser
unsigned long previousMillis = 0; // will store last time LED was updated
unsigned int sim_second = 0;
unsigned int sim_minute = 30;
unsigned int sim_hour = 12;
char last_second_dv = '0';
char last_minute_dv = '0';
char last_hour_dv = '0';
char last_second_chuc = '0';
char last_minute_chuc = '0';
char last_hour_chuc = '0';
bool enable_second_dv = false;
bool enable_minute_dv = false;
bool enable_hour_dv = false;
bool enable_second_chuc = false;
bool enable_minute_chuc = false;
bool enable_hour_chuc = false;
bool last_enable_second_dv = true;
bool last_enable_minute_dv = true;
bool last_enable_hour_dv = true;
bool last_enable_second_chuc = true;
bool last_enable_minute_chuc = true;
bool last_enable_hour_chuc = true;
int fontHeightGlobal = 0;
int fontWidthGlobal = 0;
unsigned int anim_speed_global = 40;
// Set these values to the offset of your timezone from GMT
static const int32_t zone_hours = +6L; // BST
static const int32_t zone_minutes = 0L; // usually zero
static const NeoGPS::clock_t zone_offset =
zone_hours * NeoGPS::SECONDS_PER_HOUR +
zone_minutes * NeoGPS::SECONDS_PER_MINUTE;
void adjustTime( NeoGPS::time_t & dt )
{
NeoGPS::clock_t seconds = dt; // convert date/time structure to seconds
// First, offset from UTC to the local timezone
seconds += zone_offset;
dt = seconds; // convert seconds back to a date/time structure
} // adjustTime
void char_write(int px, int py, uint8_t* font, char current )
{
// int fontWidth = dmd.charWidth(current);
// int fontHeight = font[3];
// DMDFrame scrollFrame = dmd.subFrame(px, py, fontWidth, fontHeight);
// scrollFrame.selectFont(font);
// scrollFrame.fillScreen(false);
// scrollFrame.drawChar(0, 0, current);
// dmd.copyFrame(scrollFrame, px, py);
dmd.drawChar(px, py, current);
}
void char_over_write_animation_step(int px, int py, bool enable, uint8_t* font, char current, char next, int i)
{
// int currentWidth = dmd.charWidth(current);
// int nextWidth = dmd.charWidth(next, font);
// int fontWidth = (currentWidth >= nextWidth) ? currentWidth : nextWidth;
// int fontHeight = font[3];
// DMDFrame scrollFrame = dmd.subFrame(px, py, fontWidth, fontHeight);
// scrollFrame.selectFont(font);
// scrollFrame.fillScreen(false);
// unsigned int offset_x = fontWidth;
// unsigned int offset_y = fontHeight;
//
// scrollFrame.drawChar(0, 0, current);
// if (enable) {
// scrollFrame.drawLine(0, i, offset_x - 1, i, GRAPHICS_OFF);
// scrollFrame.drawChar(0, i - offset_y , next);
// dmd.copyFrame(scrollFrame, px, py);
// } else {
// scrollFrame.drawChar(0, 0 , next);
// dmd.copyFrame(scrollFrame, px, py);
// }
if (enable) {
dmd.drawChar(px, i - fontHeightGlobal + py , next);
} else {
dmd.drawChar(px, py , next);
}
}
void run_animation(char *dmdBuff) {
char check_second_dv = dmdBuff[7];
char check_second_chuc = dmdBuff[6];
char check_minute_dv = dmdBuff[4];
char check_minute_chuc = dmdBuff[3];
char check_hour_dv = dmdBuff[1];
char check_hour_chuc = dmdBuff[0];
enable_second_dv = (check_second_dv != last_second_dv) ? true : false;
enable_second_chuc = (check_second_chuc != last_second_chuc) ? true : false;
enable_minute_dv = (check_minute_dv != last_minute_dv) ? true : false;
enable_minute_chuc = (check_minute_chuc != last_minute_chuc) ? true : false;
enable_hour_dv = (check_hour_dv != last_hour_dv) ? true : false;
enable_hour_chuc = (check_hour_chuc != last_hour_chuc) ? true : false;
//Write first
int last_offset = 1;
int offset = 0;
int number_animation = 0;
if (!enable_hour_chuc) {
if (last_enable_hour_chuc != enable_hour_chuc) {
last_enable_hour_chuc = enable_hour_chuc;
char_write(last_offset, 0, Arnr17, last_hour_chuc);
}
}
else {
number_animation++;
}
offset = dmd.charWidth(last_hour_chuc);
last_offset = last_offset + 1 + offset;
if (!enable_hour_dv) {
if (last_enable_hour_dv != enable_hour_dv) {
last_enable_hour_dv = enable_hour_dv;
char_write(last_offset , 0, Arnr17, last_hour_dv);
}
}
else {
number_animation++;
}
offset = dmd.charWidth(last_hour_dv);
last_offset = last_offset + 1 + offset;
char_write(last_offset , 0, Arnr17, ':');
offset = dmd.charWidth(':');
last_offset = last_offset + 1 + offset;
if (!enable_minute_chuc) {
if (last_enable_minute_chuc != enable_minute_chuc) {
last_enable_minute_chuc = enable_minute_chuc;
char_write(last_offset , 0, Arnr17, last_minute_chuc );
}
}
else {
number_animation++;
}
offset = dmd.charWidth(last_minute_chuc);
last_offset = last_offset + 1 + offset;
if (!enable_minute_dv) {
if (last_enable_minute_dv != enable_minute_dv) {
last_enable_minute_dv = enable_minute_dv;
char_write(last_offset , 0, Arnr17, last_minute_dv);
}
}
else {
number_animation++;
}
offset = dmd.charWidth(last_minute_dv);
last_offset = last_offset + 1 + offset;
char_write(last_offset , 0, Arnr17, ':');
offset = dmd.charWidth(':');
last_offset = last_offset + 1 + offset;
if (!enable_second_chuc) {
if (last_enable_second_chuc != enable_second_chuc) {
last_enable_second_chuc = enable_second_chuc;
char_write(last_offset , 0, Arnr17, last_second_chuc);
}
}
else {
number_animation++;
}
offset = dmd.charWidth(last_second_chuc);
last_offset = last_offset + 1 + offset;
if (!enable_second_dv) {
if (last_enable_second_dv != enable_second_dv) {
last_enable_second_dv = enable_second_dv;
char_write(last_offset , 0, Arnr17, last_second_dv);
}
}
else {
number_animation++;
}
//
int new_anim_speed = anim_speed_global - 4 * number_animation; // (anim_speed_global / number_animation) * 1.5;
for (int i = 0; i <= fontHeightGlobal; i++)
{
int last_offset = 1;
int offset = 0;
if (enable_hour_chuc) {
char_over_write_animation_step(last_offset, 0, enable_hour_chuc, Arnr17, last_hour_chuc, check_hour_chuc, i);
}
offset = dmd.charWidth(last_hour_chuc);
last_offset = last_offset + 1 + offset;
if (enable_hour_dv) {
char_over_write_animation_step(last_offset , 0, enable_hour_dv, Arnr17, last_hour_dv, check_hour_dv, i);
}
offset = dmd.charWidth(last_hour_dv);
last_offset = last_offset + 1 + offset;
// char_over_write_animation_step(last_offset , 0, false, Arnr17, ':', ':', i);
offset = dmd.charWidth(':');
last_offset = last_offset + 1 + offset;
if (enable_minute_chuc) {
char_over_write_animation_step(last_offset , 0, enable_minute_chuc, Arnr17, last_minute_chuc, check_minute_chuc, i);
}
offset = dmd.charWidth(last_minute_chuc);
last_offset = last_offset + 1 + offset;
if (enable_minute_dv) {
char_over_write_animation_step(last_offset , 0, enable_minute_dv, Arnr17, last_minute_dv, check_minute_dv, i);
}
offset = dmd.charWidth(last_minute_dv);
last_offset = last_offset + 1 + offset;
// char_over_write_animation_step(last_offset , 0, false, Arnr17, ':', ':', i);
offset = dmd.charWidth(':');
last_offset = last_offset + 1 + offset;
if (enable_second_chuc) {
char_over_write_animation_step(last_offset , 0, enable_second_chuc, Arnr17, last_second_chuc, check_second_chuc, i);
}
offset = dmd.charWidth(last_second_chuc);
last_offset = last_offset + 1 + offset;
if (enable_second_dv) {
char_over_write_animation_step(last_offset , 0, enable_second_dv, Arnr17, last_second_dv, check_second_dv, i);
}
delay(new_anim_speed);
}
if (enable_second_dv)last_second_dv = check_second_dv;
if (enable_second_chuc)last_second_chuc = check_second_chuc;
if (enable_minute_dv)last_minute_dv = check_minute_dv;
if (enable_minute_chuc)last_minute_chuc = check_minute_chuc;
if (enable_hour_dv)last_hour_dv = check_hour_dv;
if (enable_hour_chuc)last_hour_chuc = check_hour_chuc;
}
void setup()
{
dmd.setBrightness(100);
uint8_t* font = Arnr17;
dmd.selectFont(font);
dmd.begin();
dmd.clearScreen();
gpsPort.begin(9600);
fontHeightGlobal = font[3];
fontWidthGlobal = dmd.charWidth('8');
// anim_speed_global = 50;//400 / fontHeightGlobal;
}
void loop()
{
if (gps.available( gpsPort )) {
gps_fix fix = gps.read();
if (fix.valid.time) {
adjustTime( fix.dateTime );
// UTC_ind_zone_time
char dmdBuff[10];
sprintf_P( dmdBuff, PSTR("%02d:%02d:%02d"),
fix.dateTime.hours, fix.dateTime.minutes, fix.dateTime.seconds );
// dmd.drawString(1, 0, dmdBuff);
run_animation(dmdBuff);
}
}
// else//Simulator
// {
// unsigned long currentMillis = millis();
// if (currentMillis - previousMillis >= 1000) {
// previousMillis = currentMillis;
// sim_second++;
// if (sim_second > 59) {
// sim_second = 0;
// sim_minute ++;
// if (sim_minute > 59) {
// sim_minute = 0;
// sim_hour++;
// if (sim_hour > 23) {
// sim_hour = 0;
// }
// }
// }
//
// char dmdBuff[10];
// sprintf_P( dmdBuff, PSTR("%02d:%02d:%02d"),
// sim_hour , sim_minute, sim_second );
// run_animation(dmdBuff);
// }
// }
}
Please see this give me solution! Thanks.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.




