Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - kuran_kuran

Pages: 1
Tiny Arcade & Pocket Arcade / New game for TinyArcade
« on: July 24, 2017, 10:24:26 AM »
It is New!
*KemonoRogue Version 1.00
It is an rogue-like game of animation 'Kemono Friends'.

*TinySTG Version 1.02
Added new stage.

There is also an Android version.

Do you know how to write data to SD card with TinyArcade?
I want to save game data with SdFat library but I will fail by mistake.
If Sample.txt exists on the SD card, only 1st succeeds. 2nd will fail.
If Sample.txt does not exist, both 1st and 2nd will fail. zero byte Sample.txt is created.

#include <TinyScreen.h>
#include "SdFat.h"

TinyScreen tiny_screen = TinyScreen(TinyScreenPlus);
SdFat sd_fat;
int write_bytes1 = -1;
int write_bytes2 = -1;

void setup()
   // Initialize SD card
   sd_fat.begin(10, SPI_FULL_SPEED);
   // Initialize screen
   tiny_screen.setBrightness( 8 );
   tiny_screen.fontColor(TS_8b_White, TS_8b_Black);
   // Write file 1st
   SdFile file1;
   if("Sample.txt", O_RDWR | O_CREAT))
      char text[128];
      sprintf(text, "123456 text");
      write_bytes1 = file1.write(text, 12);
   // Write file 2nd
   SdFile file2;
   if("Sample.txt", O_RDWR | O_CREAT))
      char text[128];
      sprintf(text, "654321 text");
      write_bytes2 = file2.write(text, 12);

void loop()
   char text[128];
   sprintf(text, "1st %dbytes", write_bytes1);
   tiny_screen.setCursor(0, 0);
   sprintf(text, "2nd %dbytes", write_bytes2);
   tiny_screen.setCursor(0, 14);

Pages: 1
SMF spam blocked by CleanTalk