Recent Posts

Pages: 1 ... 7 8 [9] 10
Displays / Re: Problem of displaying imag...
Last post by ghlawrence2000 - Today at 02:07 pm
What shield are you using with the DUE?



Storage / Re: Read and write from SD car...
Last post by xpress_embedo - Today at 02:07 pm
Thanks for you help, that was extremely helpful.

I wrote this code and it works perfectly fine.

Code: [Select]

#include <SdFat.h>

const uint8_t ChipSelect=4;

char buffer[] = "This is xpress embedo, i am testing SD Card Library with Arduino Mega Board\r\n";
char filename[20] = {0};
SdFat intSD;

uint32_t cardSize;
uint32_t cardErase;

void setup()
  Serial.println("Initializing Memory Card");
    Serial.println("Card Init Failed");
  Serial.println("Card Initialized");
  cardSize = intSD.card()->cardSize();               // This will return the total number of blocks in the card. 
  if(cardSize == 0)
    Serial.println("Card Size Failed");
  float cardSizeKB = cardSize*512/1024.0;  // 1 Block = 512 bytes
  Serial.println(" KB");
  float cardSizeMB = cardSizeKB/1024.0;  // 1 MB = 1024KB
  Serial.println(" MB");
  float cardSizeGB = cardSizeMB/1024.0;  // 1 GB = 1024MB
  Serial.println(" GB");
  Serial.print("Card Type = ");
    case SD_CARD_TYPE_SD1:
    Serial.println("SD V1");
    case SD_CARD_TYPE_SD2:
    Serial.println("SD V2");
    Serial.println("SD High Capacity Card");
  uint32_t clusterSize = intSD.vol()->freeClusterCount();
  Serial.print("Free Cluster: ");
  float freeSpace = clusterSize*512*intSD.vol()->blocksPerCluster();
  Serial.print("Free Space in Memory Card: ");
  float freeSpaceKB = freeSpace/1024;
  Serial.print("Free Space in Memory Card: ");
  float freeSpaceMB = freeSpaceKB/1024;
  Serial.print("Free Space in Memory Card: ");
  float freeSpaceGB = freeSpaceMB/1024;
  Serial.print("Free Space in Memory Card: ");
  char date = 0x18;
  char month = 0x01;
  char year = 0x15;
  char hour = 0x20;
  char minute = 0x30;
  char second = 0x00;
  filename[0] = ((date>>4)&0x0F)|0x30;
  filename[1] = ((date)&0x0F)|0x30;
  filename[2] = '-';
  filename[3] = ((month>>4)&0x0F)|0x30;
  filename[4] = ((month)&0x0F)|0x30;
  filename[5] = '-';
  filename[6] = ((year>>4)&0x0F)|0x30;
  filename[7] = ((year)&0x0F)|0x30;
  filename[8] = '.';
  filename[9] = 't';
  filename[10] = 'x';
  filename[11] = 't';
  filename[12] = 0;

void loop()
    char ch =;
    if(ch == 'w')
      // Write to file
    else if(ch == 'r')
      //Read from file

void SD_Read(char *filename)
  SdFile myFile;
  if (!, O_READ))
    Serial.println("opening test.txt for reading failed");
  Serial.println("File Opened Successfully and now reading from file");
  int data;
  while ((data = >= 0)
  // close the file:

void SD_Write(char *filename,char*buffer)
  SdFile myFile;
  // open the file for write at end like the Native SD library
  if (!, O_RDWR | O_CREAT | O_AT_END))
   Serial.println("File Opening Failed");
  while(*buffer != '\n')
  myFile.close();  // Close the file

But when change my filename like this,
filename[0] = ((date>>4)&0x0F)|0x30;
     filename[1] = ((date)&0x0F)|0x30;
     filename[2] = '-';
     filename[3] = ((month>>4)&0x0F)|0x30;
     filename[4] = ((month)&0x0F)|0x30;
     filename[5] = '-';
     filename[6] = ((year>>4)&0x0F)|0x30;
     filename[7] = ((year)&0x0F)|0x30;
     filename[8] = '_';
     filename[6] = ((hour>>4)&0x0F)|0x30;
     filename[7] = ((hour)&0x0F)|0x30;
     filename[8] = '_';
     filename[9] = ((minute>>4)&0x0F)|0x30;
     filename[10] = ((minute)&0x0F)|0x30;
     filename[11] = '_';
     filename[12] = ((second>>4)&0x0F)|0x30;
     filename[13] = ((second)&0x0F)|0x30;
     filename[14] = '.';
     filename[15] = 't';
     filename[16] = 'x';
     filename[17] = 't';
     filename[18] = 0;

It stops working i am continuously getting error on serial port that file not created.
How can i solve this problem.
I will dig up the circuit diagram of the board, but this image is of the rs485 shield circuit that we have successfully used in the past. We have recreated this on the board pictured above where we're pretty sure the problem lies now.
We are only using the circuit in the centre here. A slight modification we've done is that the enable switch (EN1/EN2) is actually routed to an arduino pin so we can switch it on and off with code. Hence permanently in manual transmit mode when the enablePin is brought high.
An interesting thing I've found since is that when I add a 100ms delay between reading characters in Serial1.Event() it reads the message a lot clearer, though from time to time it still picks up gibberish. So I'm sure that the message is still being transmitted correctly. I've checked that the baud rates are the same.
I'm not sure if it's relevant but I am also running a high speed encoder using a single interrupt pin.

Thanks again :)
Arduino Due / Re: SAM3X8E ROM "Boot Program"...
Last post by k2tom - Today at 02:05 pm
Answering my own question...

The problem is that the "target" (address) of the SAM-BA G(o) command is not a code address.. or a Thumb2/CM3 "address+1." The Go target has to be an SP-PC pair (where the PC is the address+1).
Project Guidance / Re: LED Matrix, scrolling text...
Last post by Paul__B - Today at 02:04 pm
You need to get into the habit of using Auto Format (under Tools) to make the code progress legible.
Code: [Select]

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#define PSTR

#define PIN 6  // Ausgangspin

Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(39, 8, PIN,
NEO_GRB            + NEO_KHZ800);

const uint16_t colors[] = {
  matrix.Color(100, 100, 100), matrix.Color(0, 100, 0), matrix.Color(0, 0, 100) };  //Farbkombinationsdurchläufe

void setup() {
  matrix.setTextWrap(false);  //buchstaben laufen von hinten flüssig ins bild; bei true springt jeder Buchstabe einzeln rein
  matrix.setBrightness(40);  // Gesamthelligkeit

int x    = matrix.width();
int pass = 0;

void loop() {
  matrix.setCursor(x, 0);
    if (Serial.available()) {       // charakter erreichen serial port
      delay(100);                   // warten, bis text ankommt
      while (Serial.available() > 0) {         // lese vorhandene charakter
        matrix.write(;             // charakter auf display
        if(--x < -30) {            //Gesamtweite des möglichen Textes
          x = matrix.width();
          if(++pass >= 3) pass = 0;  //Anzahl der Farbdurchläufe
      delay(100);  //Geschwindigkeit des Text-Durchlaufes

Given that only matrix.fillScreen(0); and matrix.setCursor(x, 0); are executed when there is no input from the serial monitor, which of those do you expect to perform scrolling?

{Caveat: I have no idea whatsoever about these libraries!}

This might be a really simple / stupid question:

On the BED, there is three terminals (M1, M2 and M3) which decides the microstep settings. They have internal pullups (20K). To change microstep setting, I tie one or more to ground depending on what setup I want.

If I dont connect them to ground, but to the Arduino's digital pin (output), would it be possible to adjust microstep settings by setting the digital output either HIGH or LOW?

Arduino Yún / Re: AR9331 gpio to ATMEGA32u4
Last post by ShapeShifter - Today at 02:03 pm
At the very minimum for this to be usable, there would have to be a device driver on the Linux side.
And that could be complicated by the issue that there is no SPI device on the Linux side.

There is a SPI connection between the AR3391 and the 32U4, which is used to program sketches into the 32U4. But the only SPI hardware in the AR3391 appears to be dedicated to serial flash access, and it is not used for this function. Instead, GPIO is used, meaning the interface needs to be bit-banged on the Linux side.

According to the schematics, the connections are (AR3391 on left, 32U4 on right):
  • GPIO 26 --> SS
  • GPIO 27 --> MOSI
  • GPIO 8 <-- MISO
  • GPIO 11 --> SCK
  • GPIO 21 --> OE

That last pin is the Output Enable for the level shifter chip between the two processors; it must be brought low to enable communications.

The fact that you must bit-bang this interface on the Linux side makes me think that you won't be getting super high speeds through it.
Displays / Re: LCD and Serial monitor pro...
Last post by maia - Today at 02:02 pm
dont know if it's help, but i have such behavour with my OLED if I disconnect  GND wire "on fly".
Programming Questions / Re: Problems with big array
Last post by jurs - Today at 02:00 pm
100 KHz using timer interrupts
Timer interrupts at 100 kHz?
Perhaps you'd ask Santa Claus for a faster Arduino than you have at the moment!

The problems appears when it comes to store sine wave values in a big array. I have a 10,000 elements byte type array where I store the values for the sine function (from 0 to 255).

I tried to use PROGMEM to store these values as I don't need to modify them, but just to read them. I figured out that the maximum size allowed for the array in the 32KB memory is around 2,500.
As you told about "I'm realizing a function generator with Arduino uno" and an UNO has a TOTAL FLASH SIZE of 32KB, there is absolutely no chance to define more than 32KB constants in your program. It would not fit into the flash memory of an UNO (Atmega328).
Software / Re: consiglio programmino crea...
Last post by Brado - Today at 02:00 pm
brado, riguardo all'array potresti farmi un piccolo esempio? sono neofita :smiley-mr-green: grazie mille, fino ad ora modificavo lo sketch esempio di quel sito...
Ok essere niubbo, ma leggere i link che hai messo tu ...

Sempre in quel sito:

Code: [Select]

char xkcdSandwich[504] = {
0xFF, 0x8D, 0x9F, 0x13, 0x13, 0xF3, 0x01, 0x01, 0xF9, 0xF9, 0x01, 0x81, 0xF9, 0xF9, 0x01, 0xF1,
0xF9, 0x09, 0x09, 0xFF, 0xFF, 0xF1, 0xF9, 0x09, 0x09, 0xF9, 0xF1, 0x01, 0x01, 0x01, 0x01, 0x01,
0xF9, 0xF9, 0x09, 0xF9, 0x09, 0xF9, 0xF1, 0x01, 0xC1, 0xE9, 0x29, 0x29, 0xF9, 0xF1, 0x01, 0xFF,
0xFF, 0x71, 0xD9, 0x01, 0x01, 0xF1, 0xF9, 0x29, 0x29, 0xB9, 0xB1, 0x01, 0x01, 0x01, 0xF1, 0xF1,
0x11, 0xF1, 0xF1, 0xF1, 0xE1, 0x01, 0xE1, 0xF1, 0x51, 0x51, 0x71, 0x61, 0x01, 0x01, 0xC1, 0xF1,
0x31, 0x31, 0xF1, 0xFF, 0xFF, 0x00, 0x01, 0x01, 0x01, 0x01, 0x60, 0xE0, 0xA0, 0x01, 0x01, 0x81,
0xE1, 0x61, 0x60, 0xC0, 0x01, 0xE1, 0xE1, 0x21, 0x21, 0xE0, 0xC1, 0x01, 0xC1, 0xE1, 0x20, 0x20,
0xFC, 0xFC, 0xE0, 0xE0, 0xC1, 0xE1, 0xE0, 0xC1, 0xE0, 0xE1, 0x01, 0xFC, 0xFC, 0x21, 0x21, 0xE1,
0xC1, 0xE5, 0xE4, 0x01, 0xC1, 0xE0, 0x20, 0x21, 0x20, 0x00, 0x01, 0xFD, 0xFD, 0x21, 0x20, 0xE0,
0x00, 0x00, 0x01, 0x01, 0xC0, 0x61, 0x31, 0x31, 0x21, 0x20, 0xC0, 0x81, 0x01, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x02,
0x03, 0x01, 0x00, 0x01, 0x03, 0xF2, 0x1A, 0x0B, 0x08, 0x0B, 0x1B, 0x10, 0x60, 0xE3, 0x03, 0x00,
0x01, 0x03, 0x02, 0x02, 0x03, 0x03, 0x00, 0x03, 0x03, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x03,
0x03, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x00, 0x01, 0x03, 0x02, 0x02, 0x03, 0x01, 0x00, 0x03,
0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3E, 0x63, 0x80, 0x80, 0x80, 0x80, 0x60, 0x3F, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFE, 0x01, 0x01, 0x01, 0x02, 0x03, 0x3E, 0xE8, 0xF8, 0xF0, 0xD0, 0x90,
0x18, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x38, 0xFF,
0x0C, 0x38, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33,
0x5F, 0x8F, 0x84, 0x05, 0x07, 0x06, 0x0C, 0x0E, 0x0E, 0x0C, 0x14, 0x34, 0x68, 0x88, 0xD8, 0x70,
0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0xE0, 0x00, 0xF0, 0xF0, 0x00, 0x80,
0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x20, 0x38,
0x0E, 0x01, 0xC0, 0x3F, 0xE0, 0x00, 0x00, 0x03, 0x0E, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xFF, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xB6, 0xED, 0xC0, 0xC0,
0xC0, 0xE0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA1, 0xA1, 0xA1, 0xA1, 0xA1, 0xA1, 0xA1, 0xE1, 0xE1, 0xC1,
0xEF, 0xBB, 0x83, 0x86, 0x88, 0xB0, 0x80, 0x80, 0x80, 0x8F, 0x90, 0x90, 0x90, 0x9F, 0x8F, 0x80,
0x9F, 0x9F, 0x87, 0x8D, 0x98, 0x80, 0x8C, 0x9E, 0x92, 0x92, 0x9F, 0xC0, 0xC7, 0xFF, 0xB8, 0x8F,
0x80, 0x90, 0x90, 0xC0, 0xF0, 0x8E, 0x81, 0x80, 0x81, 0x8F, 0xB8, 0xE0, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFF,

Questo è un char array chiamato xkcdSandwich ...
Pages: 1 ... 7 8 [9] 10

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131