本文整理汇总了C++中Adafruit_ST7735::println方法的典型用法代码示例。如果您正苦于以下问题:C++ Adafruit_ST7735::println方法的具体用法?C++ Adafruit_ST7735::println怎么用?C++ Adafruit_ST7735::println使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Adafruit_ST7735
的用法示例。
在下文中一共展示了Adafruit_ST7735::println方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tftPrintTest1
void tftPrintTest1() {
tft.setTextWrap(false);
tft.fillScreen(ST7735_BLACK);
tft.setCursor(0, 30);
tft.setTextColor(ST7735_RED);
tft.setTextSize(1);
tft.println("Hello Sming!");
tft.setTextColor(ST7735_YELLOW);
tft.setTextSize(2);
tft.println("Hello Sming!");
tft.setTextColor(ST7735_GREEN);
tft.setTextSize(3);
tft.println("Hello Sming!");
tft.setTextColor(ST7735_BLUE);
tft.setTextSize(4);
tft.print(1234.567);
}
示例2: tftPrintTest
void tftPrintTest() {
tft.setTextWrap(false);
tft.fillScreen(ST7735_BLACK);
tft.setCursor(0, 30);
tft.setTextColor(ST7735_RED);
tft.setTextSize(1);
tft.println("Hello World!");
tft.setTextColor(ST7735_YELLOW);
tft.setTextSize(2);
tft.println("Hello World!");
tft.setTextColor(ST7735_GREEN);
tft.setTextSize(3);
tft.println("Hello World!");
tft.setTextColor(ST7735_BLUE);
tft.setTextSize(4);
tft.print(1234.567);
delay(1500);
tft.setCursor(0, 0);
tft.fillScreen(ST7735_BLACK);
tft.setTextColor(ST7735_WHITE);
tft.setTextSize(0);
tft.println("Hello World!");
tft.setTextSize(1);
tft.setTextColor(ST7735_GREEN);
tft.print(p, 6);
tft.println(" Want pi?");
tft.println(" ");
tft.print(8675309, HEX); // print 8,675,309 out in HEX!
tft.println(" Print HEX!");
tft.println(" ");
tft.setTextColor(ST7735_WHITE);
tft.println("Sketch has been");
tft.println("running for: ");
tft.setTextColor(ST7735_MAGENTA);
tft.print(millis() / 1000);
tft.setTextColor(ST7735_WHITE);
tft.print(" seconds.");
}
示例3: setup
void setup() {
Serial.begin(9600);
// initialise display
tft.initR(INITR_BLACKTAB);
tft.fillScreen(ST7735_BLACK);
// initialise pins
pinMode(leftPin, INPUT);
pinMode(rightPin, INPUT);
pinMode(turnPin, INPUT);
// display splashscreen
tft.setTextColor(ST7735_WHITE);
tft.setTextWrap(true);
tft.setCursor(34, 20);
tft.println("WELCOME TO");
tft.setCursor(45, 30);
tft.println("~TETRIS");
tft.setCursor(16, 50);
tft.println("PRESS THE MIDDLE");
tft.setCursor(18, 60);
tft.println("BUTTON TO START");
tft.setCursor(57, 110);
tft.println("BY:");
tft.setCursor(33, 120);
tft.println("NICHOLAS LI");
tft.setCursor(56, 130);
tft.println("AND");
tft.setCursor(24, 140);
tft.println("ARJUN KALBURGI");
// only continue if turnPin is pressed
while(digitalRead(turnPin) == LOW) {}
tft.fillScreen(ST7735_BLACK);
}
示例4: draw_map_screen
void draw_map_screen() {
#ifdef DEBUG
// Want to display a small message saying that we are redrawing the map!
tft.fillRect(78, 148, 50, 12, GREEN);
tft.setTextSize(1);
tft.setTextColor(MAGENTA);
tft.setCursor(80, 150);
tft.setTextSize(1);
tft.println("DRAWING...");
#endif
lcd_image_draw(&map_tiles[current_map_num], &tft
, screen_map_x, screen_map_y
, 0, 0, 128, 160);
}
示例5: status_msg
void status_msg(char *msg) {
// messages are strings, so we assume constant, and if they are the
// same pointer then the contents are the same. You can force by
// setting prev_status_msg = 0
const uint16_t msg_text_height = 10;
const uint16_t msg_window_height = msg_text_height+2;
if ( prev_status_msg != msg ) {
prev_status_msg = msg;
tft.fillRect(0, display_window_height - msg_window_height,
display_window_width, msg_window_height, GREEN);
tft.setTextSize(1);
tft.setTextColor(MAGENTA);
tft.setCursor(0, display_window_height - msg_text_height);
tft.setTextSize(1); // 10 pixels high
tft.println(msg);
}
}
示例6: tftPrintTest2
void tftPrintTest2() {
tft.setCursor(0, 0);
tft.fillScreen(ST7735_BLACK);
tft.setTextColor(ST7735_WHITE);
tft.setTextSize(0);
tft.println("Hello Sming!");
tft.setTextSize(1);
tft.setTextColor(ST7735_GREEN);
tft.print(p, 6);
tft.println(" Want pi?");
tft.println(" ");
tft.print(8675309, HEX); // print 8,675,309 out in HEX!
tft.println(" Print HEX!");
tft.println(" ");
tft.setTextColor(ST7735_WHITE);
tft.println("Sketch has been");
tft.println("running for: ");
tft.setTextColor(ST7735_MAGENTA);
tft.print(millis() / 1000);
tft.setTextColor(ST7735_WHITE);
tft.print(" seconds.");
}
示例7: dualPrint
void dualPrint(char *s) {
Serial.println(s);
tft.println(s);
}
示例8: loop
void loop() {
// Though counter-intuitive, game creation cannot be in setup because of varying arduino boot times and boot gibberish
if (!gameCreated) {
drawGUI();
while(!waitUntil(JOYSTICK_BUTTON_PIN, false));
if (!startNetwork()) {
tft.fillScreen(ST7735_BLACK); // we must clear all conflicting messages from screen
tft.setCursor(0,0);
dualPrint("Network connection failed!");
dualPrint("Please ensure:");
dualPrint("1) both arduinos are connected");
dualPrint("2) both parties pressed the joystick");
dualPrint("If both are true, consult someone who");
dualPrint("looks like he knows what he's talking about");
dualPrint("Reset both Arduinos to try again");
while(1);
}
/* Extensibility Goal:
* Enable colour selection here, time permissible
*/
gameCreated = true;
}
if (!gameStarted) {
setSpawns(&player1, &player2);
setColour(&player1, &player2);
tft.fillScreen(ST7735_BLACK);
startCountdown();
gameStarted = true;
}
winner = gameOver(&player1.currentPosition, &player2.currentPosition);
if (winner) {
tft.setCursor(0, 80);
String message;
switch (winner) {
case -1:
message = "YOU SUPER TIE";
break;
case 1:
message = "YOU SUPER WIN";
player1.score++;
break;
case 2:
message = "YOU SUPER LOSE";
player2.score++;
break;
}
tft.println(message);
tft.println("SCORES:");
tft.print("You: ");
tft.print(player1.score);
tft.print(" | Him: ");
tft.println(player2.score);
tft.println("Again? <Press Joystick>");
waitUntil(JOYSTICK_BUTTON_PIN, LOW);
memset(&wallPositions, 0, 2560); // 2560 is a magic number because size_ts were acting unexpectedly
gameStarted = false;
tft.fillScreen(ST7735_BLACK);
} else {
// add a wall ad draw car at current position
addWallPosition(player1.currentPosition);
addWallPosition(player2.currentPosition);
tft.fillRect(player1.currentPosition.x, player1.currentPosition.y, 2, 2, player1.colour);
tft.fillRect(player2.currentPosition.x, player2.currentPosition.y, 2, 2, player2.colour);
movement_t newDirection = getJoystickInput();
if (validInput(newDirection, player1.direction)) player1.direction = newDirection;
sendDeltas(&player1.direction);
receiveDeltas(&player2.direction);
player1.currentPosition.x += player1.direction.x;
player1.currentPosition.y += player1.direction.y;
player2.currentPosition.x += player2.direction.x;
player2.currentPosition.y += player2.direction.y;
delay(75); // this is how we control the game speed
/* Extensibility Goal:
* Find a more efficient and reliable way of controlling game speed.
* Implement it, and allow it to be customized
*/
}
}