Difference between revisions of "4 Hello, World!"

From Banana Pi Wiki
Jump to: navigation, search
(Program using PyCharm)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[File:Webduino_gif.gif|thumb|Overview: [[BPI-Bit]]]]
 +
[[File:Micropython3.png|thumb|[[1 Get the development suite]] ]]
 +
[[File:Micropython2.png|thumb|[[2 Wired connection board]] ]]
 +
[[File:Micropython2.png|thumb|[[3 Try burning the board]] ]]
 +
[[File:Micropython2.png|thumb|[[4 Hello, World!]] ]]
 +
[[File:Micropython2.png|thumb|[[5 Light up all kinds of LED]] ]]
 +
 +
 +
[[File:Micropython4.png|thumb|[[1  Auto series one key burn]] ]]
 +
[[File:Micropython2.png|thumb|[[2  ESPBlocks Beginner's only]] ]]
 +
[[File:Micropython2.png|thumb|[[3 Mpfshell details]] ]]
 +
[[File:Micropython2.png|thumb|[[4 Pycharm IDE programming]] ]]
 +
 +
 +
[[File:Micropython5.png|thumb|[[1. Panel scrolling text]] ]]
 +
[[File:Micropython2.png|thumb|[[2. Panel display images]] ]]
 +
[[File:Micropython2.png|thumb|[[3 Bottom IO port control]] ]]
 +
[[File:Micropython2.png|thumb|[[4 Panel key detection]] ]]
 +
[[File:Micropython2.png|thumb|[[5 Gets the board temperature]] ]]
 +
[[File:Micropython2.png|thumb|[[6 Play MIDI music]] ]]
 +
[[File:Micropython2.png|thumb|[[7 Photosensitive gesture]] ]]
 +
[[File:Micropython2.png|thumb|[[8. MPU-9250 9-axis sensor]] ]]
 +
[[File:Micropython2.png|thumb|[[9. Make a compass]] ]]
 +
[[File:Micropython2.png|thumb|[[10 Free to define gestures]] ]]
 +
[[File:Micropython2.png|thumb|[[11 Random number generator]] ]]
 +
[[File:Micropython2.png|thumb|[[12 S2m Scratch2]] ]]
 +
[[File:Micropython2.png|thumb|[[13 Codelab Scratch3]] ]]
 +
 +
[[File:Micropython6.png|thumb|[[1 The basic algorithm]]  ]]
 +
[[File:Micropython2.png|thumb|[[2 WiFI wireless connection]] ]]
 +
[[File:Micropython2.png|thumb|[[3 WiFI wireless programming]] ]]
 +
[[File:Micropython2.png|thumb|[[MQTT communication applications]]]]
 +
 +
 
Hello World is one of the most famous programs.For every programmer, this program is the first example program in almost every programming language.In fact, all it does is tell the computer to say Hello World.Traditionally, this program has been used by programmers to test a new system or programming language.For programmers, seeing these two words on a computer screen is often a sign that their code is ready to compile, load, and run, and this output is meant to prove it, so take this as an example.
 
Hello World is one of the most famous programs.For every programmer, this program is the first example program in almost every programming language.In fact, all it does is tell the computer to say Hello World.Traditionally, this program has been used by programmers to test a new system or programming language.For programmers, seeing these two words on a computer screen is often a sign that their code is ready to compile, load, and run, and this output is meant to prove it, so take this as an example.
  

Latest revision as of 02:36, 21 February 2019

Overview: BPI-Bit




Hello World is one of the most famous programs.For every programmer, this program is the first example program in almost every programming language.In fact, all it does is tell the computer to say Hello World.Traditionally, this program has been used by programmers to test a new system or programming language.For programmers, seeing these two words on a computer screen is often a sign that their code is ready to compile, load, and run, and this output is meant to prove it, so take this as an example.

Program with MpfShell

  • Tips: please burn the MicroPython firmware before use.
  • For the needed materials, please go here to download windows-mpfshell. exe, which needs to be manually selected because the software version may be updated.

Run the program through repl

Program.png

(take Windows as an example) double-click to run windows-mpfshell.exe.

Index.png

BPI:bit
The colors that appear in turn explain
white Displays all supported command actions, top command for helpful instructions, bottom command for reverse.
yellow The above command for all the support, if you want to know the usage of the ls ` ` input ` help ls `.
blue Show the current insert board serial port name, as shown for ` com5 `, can input ` open com5 ` connected devices
  • To try to connect to the device, type open com5 (or o com5 for short). If nothing happens, use CTRL + C or the Red Cross in the upper right corner.

Opendev.png

  • Now hint: start the panel for the first time, if the networking function is used, if the lamp is connected to the panel when it is still rolling, the networking operation may be stopped, so when the networking function is found to be stopped, you need to manually execute wifi. Start () in repl, or use exec to execute the statement.
  • Previous tips: the first time you start the board, the first time the connection fails, you can try again according to the tips, so please pay attention to the red message.

Connected.png

  • When the Connected to esp32 is displayed, you can confirm that the board has been Connected successfully.
  • At this point, type repl again, go to the base programming environment, and write down your first program, for example: print('Hello, World! ')
  • Tip: the latest firmware in boot REPL there could be no found AP, want to stop it can input wifi. The close (), external operation, this does not affect the board just can affect the output of REPL position, set the firmware board electricity automatically connected to the Internet, the network configuration file in internal wifi_cfg. Py, because everyone's environment is different, so the default connection webduino. IO/webduino, its output message affects only the display, do not affect function.

Print helloworld.png

  • Echo the Hello, World! If you have successfully run your first program, you can continue to type in the code to test it.
  • More programming usage will be covered in subsequent chapters.

Run the program through main.py

  • Create a new main.py file and write the following.
print('Hello, World!')
  • If you want to use the MpfShell to execute this file, place it in the same directory as the MpfShell.

Main.png

  • Then switch to the program area of the MpfShell, and enter runfile main.py, or rf main.py, runfile short for rf.

Main result.png

You can see that the echo of hello world indicates that you have successfully run the program.

  • Useful hint: the latest mpfshell instruction has a lexecfile, which you can use if you need to interact with python input, because runfile can only receive board output and not input.

Program using PyCharm

To use methods, please see 4 Pycharm IDE programming