Making a quize robot

So, I'm realy new to arduino, and my project is making a mini robot that does quizes. I'm trying to program it, but I'm stuck.

I'm using an arduino due, 2.4'' tft mcufriend ILI9325 tft shield, 4x4 keypad and an SD Module. The main problem (aside from not knowing java very well, only delphi and pascal) is that, when I try an example from the library I use, everything Works, but when i change it a little the code compiles and uploads to the board, but nothing Works. I asume It's my lack of programming knowledg.

Here's what my robot is ment to do:

  1. I have 15 txt files on my SD card, in each there is a question and 4 answers.
  2. (I planed on using 'for') It shows a question on the screen. Note that every question has it's own pre-defined correct answer, exp: For the 1 first question the correct answer is always c, for the second always D, for the third always B ... etc
  3. The user uses the 4x4 Keypad to awsner. If he awnsers correct, show next queston on screen, if not, show the correct awnser then next question. Count the correct and incorect awsners and show them on the screen at the end of the quiz.

For the screen I'm using the Adafruit_GFX library in combination with MCUFRIEND_kbv library, for the SD module I'm using the SD-master library.

I could do this code in delphi, but I'm having dificulties with arduino.

Any help, sugestion, advice, will be very, very helpful.

This is a project for a competition for a scholarship, so It's very important to me. Thank you in advance.

Arduino code is written in C, not Java. The IDE itself uses java, but not the sketch.

That project sounds pretty straghtforward. I'm sure there are examples around here of doing things very similar to that.

In terms of help on the programming, I'm not sure how else we could help you, since you haven't showed us the code that's supposed to do that but doesn't.

Oh, thanks, I thought it was Java 'couse it said something of it on the official site, I've must have gotten that wrong.

It would be of real big help if anyone could write an example for showing a txt. file from SD card on the tft, I looked on the internet for days and found very little. Same for the keypad input, how to store the input and use it as a variable in 'if'.

I know it's asking a bit much, but it would be of realy great help.

Oh, and sorry for my english, I know It's not very good.

Broda: It would be of real big help if anyone could write an example for showing a txt. file from SD card on the tft, I looked on the internet for days and found very little.

There might not be an example that does exactly what you want to do with question and answers, but there are tons of examples for reading data from a text file with Arduino and thousands of examples of printing text to a tft. You want to earn a scholarship by showing how smart you are. So just put 2 and 2 together.

Broda: Same for the keypad input, how to store the input and use it as a variable in 'if'.

Total bullshit. There are literally thousands of tutorials on using a 4x4 keypad to enter numbers and save them in a variable. There is at least one or two threads about that each day that come up on this forum. Don't tell us you've looked if you haven't. I know for a fact that you haven't looked very hard if you haven't found anything about reading in numbers from a keypad.

I did look, and everything I found was for the Uno board with different libraries, and i tried puting 'em together, but it wouldn't work with the libraries i use for due.

I assumed the code was different, because of the various different comands for different libraries.

I finished my code, but It's still the same. The code compiles and uploads successfully, but nothing works. The screen on my tft just glows white, the keypad doesn't respond.

Here is the link to the code I'm using http://pastebin.com/vmULpLxc. Logicly I think the code is ok, I don't know what the problem is.

What am I missing?

Broda: What am I missing?

The forum guidelines in the second thread in this forum. Please post your code, in code tags as explained there. Don't make us surf to a wastebin link.

aarg:
The forum guidelines in the second thread in this forum. Please post your code, in code tags as explained there. Don’t make us surf to a wastebin link.

But it exides the limit of 9000 characters.

Broda:
But it exides the limit of 9000 characters.

It is explained in the forum guidelines that you can add that as an attachment.

I’m sorry for not read the instructions thoroughly, and wasting your time with that. I’ll make the code as an attachment.

As I said, it compiles and uploads, but nothing is working. Thanks in advance!

quiz.ino (17.4 KB)

Broda: As I said, it compiles and uploads, but nothing is working. Thanks in advance!

Have you tried inserting serial debug statements in key places, to try and see where it is failing? You could do this near the beginning of loop(), to discover whether the keypad part is working.

No haven't, and I can't say that I know how. Can you give some furder instructions if possible?

Serial.println(whatever you want to find out about goes here);

I tried it like this:

void loop() {
 
 for (int x = 1; x<16; x++) { 
  if (x == 1){ 
    File myFile = SD.open("1. Pitanje.txt");
  if (myFile) {
    tft.print("1. Pitanje.txt");
    Serial.println("1. Pitanje.txt");
  while (myFile.available()) {
    tft.print(myFile.read());
    char keypressed = key.getKey();
    Serial.println(keypressed);
  }

But nothing happend, still nothing works. The serial monitor shows nothing.