Ein Roboter mit bürstenlosem Antrieb, differenzial und NRF24L01 Funk. Großflächig gebaut um ein großes Solarpanel aufzunehmen. https://gitlab.informatik.hs-fulda.de/fdai5253/roboter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.5 KiB

  1. #ifdef MAPLE_IDE
  2. #include <stdio.h>
  3. #include "wirish.h"
  4. extern void setup(void);
  5. extern void loop(void);
  6. void board_start(const char* program_name)
  7. {
  8. // Set up the LED to steady on
  9. pinMode(BOARD_LED_PIN, OUTPUT);
  10. digitalWrite(BOARD_LED_PIN, HIGH);
  11. // Setup the button as input
  12. pinMode(BOARD_BUTTON_PIN, INPUT);
  13. digitalWrite(BOARD_BUTTON_PIN, HIGH);
  14. SerialUSB.begin();
  15. SerialUSB.println("Press BUT");
  16. // Wait for button press
  17. while ( !isButtonPressed() )
  18. {
  19. }
  20. SerialUSB.println("Welcome!");
  21. SerialUSB.println(program_name);
  22. int i = 11;
  23. while (i--)
  24. {
  25. toggleLED();
  26. delay(50);
  27. }
  28. }
  29. /**
  30. * Custom version of _write, which will print to the USB.
  31. * In order to use it you MUST ADD __attribute__((weak))
  32. * to _write in libmaple/syscalls.c
  33. */
  34. extern "C" int _write (int file, char * ptr, int len)
  35. {
  36. if ( (file != 1) && (file != 2) )
  37. return 0;
  38. else
  39. SerialUSB.write(ptr,len);
  40. return len;
  41. }
  42. /**
  43. * Re-entrant version of _write. Yagarto and Devkit now use
  44. * the re-entrant newlib, so these get called instead of the
  45. * non_r versions.
  46. */
  47. extern "C" int _write_r (void*, int file, char * ptr, int len)
  48. {
  49. return _write( file, ptr, len);
  50. }
  51. __attribute__((constructor)) __attribute__ ((weak)) void premain()
  52. {
  53. init();
  54. }
  55. __attribute__((weak)) void setup(void)
  56. {
  57. board_start("No program defined");
  58. }
  59. __attribute__((weak)) void loop(void)
  60. {
  61. }
  62. __attribute__((weak)) int main(void)
  63. {
  64. setup();
  65. while (true)
  66. {
  67. loop();
  68. }
  69. return 0;
  70. }
  71. #endif // ifdef MAPLE_IDE
  72. // vim:cin:ai:sts=2 sw=2 ft=cpp