If you don't already have an editor you like, then I suggest using Geany for this course. Other editors can do the same, but if you find yourself reading the error messages from the C compiler and counting lines in the source file, then you are using precious brain cells to do something a machine can do better. I developed the programs using Emacs myself, which can invoke make in an editor window, parse any resulting error messages, and show the lines of source code where the errors occurred. If you already have a preferred editor, especially one that is able to build the program being edited by invoking make, then you can use it to edit the provided programs and make micro:bit programs of your own. Our micro:bits will be powered over USB, and will also communicate with the host computer over USB for downloading programs, for sending and receiving charaters on the serial port, and for connection with debugging software running on the host. Some cables (often the ones supplied for charging bike lights, in my experience) have power wires only, and they are useless for our purposes. The cable doesn't need to be very long, but it does need both power and data wires in it. This we ask you to supply, because you probably have several spare ones already – they are the kind often used with mobile phones. A USB cable, with a full-size 'Type A' plug on one end and a 'Micro B' plug on the other.To carry out the instructions, you will need: Like all the programs we will work with, this one depends on no machine-specific library code, so all the details of how the machine is programmed are explicit. You can get started with programming the micro:bit by building and running a simple program that lets you connect to the micro:bit over a serial interface, then echoes the characters that you type. You can do this from the unix command line, and upload the resulting binary program by copying it with a shell command to a virtual disk drive that represent's the micro:bit's memory. The actions needed to prepare each program are spelled out in a Makefile, which can be interpreted by the unix program make to build the program automatically. The solution is to load the project file in again.The purpose of this lab exercise is to get started with using the micro:bit and the software toolchain that supports building programs for it. Geany sometimes forgets what the Execute button should do. Load new project files or re-load old ones using Open option in the Project menu. When you re-start geany it loads in the previous project file it used. When it executes a file it createsĪ temporary script called geany_run_script.sh. geany suffix) to specify which files belong to a project, what should happen when Clicking on an error message makes the editor's cursor go to the appropriate line in the appropriate file.īehind the scenes, geany uses project files (with a.Make All (in the Build menu) creates a runnable program from multiple source files as long as things have been set up correctly. o suffix, not a runnable program)! Build (in the Build menu) tries to produce a runnable program from a single source file. When you press the Compile button, files are automatically saved.The tabbed panel to the left of the editor offers short-cuts to useful code fragments and files.Holding Control when releasing the mouse button will copy the text instead. If you drag some highlighted text in the editor of Geany, the text is moved to the position where the mouse pointer is when releasing the mouse button.geany suffix).įull details are in the Manual or geany's Help menu. Use the project file that's in the folder where your source files are (it has a. For CUED's 1ATrading exercise you can fix this by loading the project file in (it's best to start by doing this rather than loading in the individual files). Window), the files will be opened in geany's editor, and you may even by able to use the Make all option to create a new executable program, but the Execute button won't work. If you drag multiple source files onto the icon (or the opened geany You can start it by typing its name (followed, optionally, by a C++ filename), byĬlicking on its icon (it's in the Programming section of the Applications taskbar menu), or by The compilation of multi-file source code. It uses g++ to compile the code and make to deal with It has an editor and some support for multi-file source code. Geany is an IDE ( Integrated Development Environment) for C++ (and some other languages).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |