- Code: Select all
num += 1;
gb.display.println(num);
When I run it on the gamebuino it just returns a stable "1", or sometimes a "0" if I try other methods of adding 1 to the variable every cycle.
num += 1;
gb.display.println(num);
num = 1 + num;
gb.display.println(num);
int num = 255
num = num + 3
volatile int num = 0 //says that num is a volatile integer (volatile meaning it is stored in RAM for fast access)
while(true) {
num += 1;
gb.display.println(num);
}
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F("super dumb app"));
gb.popup(F("now counting"), 40);
}
// the loop routine runs over and over again forever
void loop(){
//updates the gamebuino (the display, the sound, the auto backlight... everything)
//returns true when it's time to render a new frame (20 times/second)
if(gb.update()){
//prints Hello World! on the screen
gb.display.println(F("Hello World!"));
//declare a variable named count of type integer :
int count;
int test = 255;
volatile int num = 0; //says that num is a volatile fast acces RAM integer
//get the number of frames rendered and assign it to the "count" variable
count = gb.frameCount;
//prints the variable "count"
gb.display.println(count);
//me stuffz
gb.battery.show = false;
gb.display.println("Jason Harriot 2015");
while(true) {
num += 1;
gb.display.println(num);
}
}
}
while(true) {
num += 1;
gb.display.println(num);
gb.update(); // <---- add this
}
while{
if(gb.update()){ //returns true each time a frame is rendered
//the code placed here will run once a frame
}
}
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F("super dumb app"));
gb.popup(F("now counting"), 40);
}
// the loop routine runs over and over again forever
void loop(){
//first screen
while(1){
if(gb.update()){
//prints Hello World! on the screen
gb.display.println(F("Hello World!"));
//declare a variable named count of type integer :
int count;
int test = 255;
//get the number of frames rendered and assign it to the "count" variable
count = gb.frameCount;
//prints the variable "count"
gb.display.println(count);
//me stuffz
gb.battery.show = false;
gb.display.println("Jason Harriot 2015");
if(gb.buttons.pressed(BTN_A)){
break; //break out of the while loop when A is pressed
}
}
}
//second screen
int num = 0; //says that num is a volatile fast acces RAM integer
while(true) {
if(gb.update()){
num += 1;
gb.display.println(num);
if(gb.buttons.pressed(BTN_A)){
break; //break out of the while loop when A is pressed
}
}
}
//title screen to be able to get back to the game list
gb.titleScreen(F("super dumb app"));
}
void loop {
while(1) {
if (gb.update()) {
gb.display.println("Potato!");
}
}
}
void loop {
while(1) {
if (gb.update()) {
gb.display.println("Potato!");
if (gb.button.pressed(BTN_C) {//If I Press C
break;
break;
}
}
}
gb.titlescreen("Hi There!")
}
//imports the SPI library (needed to communicate with Gamebuino's screen)
#include <SPI.h>
//imports the Gamebuino library
#include <Gamebuino.h>
//creates a Gamebuino object named gb
Gamebuino gb;
// the setup routine runs once when Gamebuino starts up
void setup(){
// initialize the Gamebuino object
gb.begin();
//display the main menu:
gb.titleScreen(F("super dumb app"));
}
// the loop routine runs over and over again forever
void loop(){
//first screen
while(true){
if(gb.update()){
//prints Hello World! on the screen
gb.display.println(F("Hello World!"));
//declare a variable named count of type integer :
int count;
count = gb.frameCount; //get the number of frames rendered and assign it to the "count" variable
//prints the variable "count"
gb.display.println(count);
//me stuffz
gb.display.println("Jason Harriot 2015");
if(gb.buttons.pressed(BTN_A)){
break; //break out of the while loop when A is pressed
}
}
}
//second screen
int num = 0;
int offsetpause = 0;
while(true){
if(gb.update()){
if(gb.buttons.pressed(BTN_A)){
if(offsetpause = 1){
offsetpause = 0;
}
else{
if(offsetpause = 0){
offsetpause = 1;
}
if(offsetpause = 1){
num += 1;
}
gb.display.println(num);
if(gb.buttons.pressed(BTN_B)){
num = 0;
gb.popup(F("reset"), 5);
}
if(gb.buttons.pressed(BTN_C)){
break; //break out of the while loop when C is pressed
}
}
}
//title screen to be able to get back to the game list
gb.titleScreen(F("super dumb app"));
}
Return to Programming Questions
Users browsing this forum: No registered users and 7 guests