From 75d9169d5d67a32593d7c94a7579d54e83a38425 Mon Sep 17 00:00:00 2001 From: "Philip (flip) Kromer" Date: Thu, 2 Nov 2023 09:57:54 -0500 Subject: [PATCH 1/2] Update README.md to address first round of confusions --- README.md | 51 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index de44b6d..250c994 100644 --- a/README.md +++ b/README.md @@ -13,31 +13,49 @@ Trust the project. ## Install the Scala plugin. -Open up the Ev3ScalaExample/src/ev3dev4s/HelloWorld.scala file. (It will look monochrome.) +Open up the `Ev3ScalaExample/src/ev3dev4s/examples/FiveXHelloWorld.scala` file. (It will look monochrome.) You'll be invited to install the Scala plugin (upper right corner). Install Scala Plugin -> OK -Restart Intellij to get the Scala plugin going - -In the upper right Set Up JDK -> Version 11 , Eclipse Temurin 11.0.16 -> OK - -In the upper right Set Up Scala SDK -> Use Library -> Download 2.13.8 -> OK -> OK +From the popup in the lower right, restart Intellij to get the Scala plugin going. (It will keep offering the plugin until you do). + +In the upper right +* Set Up JDK -> +* Version 11, Eclipse Temurin 11.0.16 -> +* OK + +In the upper right: +* Set Up Scala SDK -> +* Use Library -> +* Create -> +* Download 2.13.x (i.e. the latest in the version 2 branch -- NOT VERSION 3) -> +* OK (installs files) -> +* OK (activates plugin) ## Have Intellij understand the project structure -Set up for mill in intellij (So that intellij will know how everything hangs togeter) -```./millw mill.bsp.BSP/install``` +Start a terminal window (by launching the Terminal app or clicking the terminal button `[>_]` in the lower left sidebar). +Run this command to set up for mill in intellij (So that intellij will know how everything hangs together): + +``` ./millw mill.bsp.BSP/install ``` -In intellij's terminal, +In intellij's terminal, remove the .idea directory (`rm -rf .idea`) -```rm -rf .idea``` +``` mv .idea /tmp/dot-idea-away ``` Close intellij. Reopen it. -File -> New -> Project from Existing Sources -> ev3dev-lang-scala -Import project from external model -> BSP -> Create +* Click File -> New -> Project from Existing Sources +* navigate to the ev3dev-lang-scala directory (possibly in your home directory under `IdeaProjects`) +* Select "Import project from external model" -> BSP -> Create + +Test that you can navigate in the source code. + +* Open up `Ev3ScalaExample/src/ev3dev4s/examples/FiveXHelloWorld.scala` +* place the cursor into the word "Sound" inside the `run` method +* touch Command-b -Test that you can navigate in the source code. Open up Ev3ScalaExample/src/ev3dev4s/HelloWorld.scala , then select Ev3KeyPad and touch Command-b . It should open the Ev3KeyPad.scala file. +It should open the Ev3KeyPad.scala file. --- @@ -65,10 +83,14 @@ Intellij Idea will let you open up a second terminal with the big +, so you can ## Shell into the Ev3 +The default network name for the EV3 is `ev3dev.local` (used in these examples); if you have renamed it, say, "firefly" it will be `firefly.local`. Use ssh to connect + ```ssh robot@ev3dev.local``` -And enter your password when prompted. (You are sure you want to continue connecting.) + +Enter your password when prompted and confirm you are sure you want to continue connecting. Run in the shell + ```brickrun -r -- java -cp Ev3LangScala.jar ev3dev4s.JarRunner Ev3LangScalaExample.jar examples.HelloWorld``` (It will blink green for about 45 seconds before honking and starting) @@ -78,6 +100,7 @@ When you're done, ```exit``` --- + # Run without the shell (for competitions) In the ev3dev OS menu on the Ev3 From 342d76e31dcd06e3aef9610aaccd1ccd968f64b9 Mon Sep 17 00:00:00 2001 From: "Philip (flip) Kromer" Date: Fri, 3 Nov 2023 14:29:23 -0400 Subject: [PATCH 2/2] Finished updates to getting started instructions --- README.md | 67 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 250c994..4509b4c 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,43 @@ # Set up Intellij Idea to write Ev3 code -## Download and install Intellij Idea Community Edition from https://www.jetbrains.com/idea/download/#section=mac +## Download and install Intellij Idea Community Edition from https://www.jetbrains.com/idea/download/#section=mac -## Clone (copy the source code onto this computer) the Ev3LangScala project from github +## Clone (copy the source code onto this computer) the Ev3LangScala project from GitHub -When you first start Intellij - "Get From VCS" . (Or - if intellij is already installed) Top Menu Bar -> Git -> Clone) -Agree to install XCode if asked. -Github -> Log into github -> Authorize github -> supply a github username and password -> Authorize Jetbrains -Select ev3-dev-lang-scala -> Clone -(You might get an error - small red dot in bottom right corner. Install Xcode's git, then run around the "Get from VCS" again) -Trust the project. +When you first start Intellij: -## Install the Scala plugin. +* "Get From VCS" . (Or if intellij is already installed, Top Menu Bar -> Git -> Clone) +* Agree to install XCode if asked. +* GitHub -> Log into GitHub -> Authorize GitHub -> supply a GitHub username and password -> Authorize Jetbrains +* Select ev3-dev-lang-scala -> Clone (You might get an error - small red dot in bottom right corner. Install Xcode's git, then run around the "Get from VCS" again). +* Trust the project. -Open up the `Ev3ScalaExample/src/ev3dev4s/examples/FiveXHelloWorld.scala` file. (It will look monochrome.) -You'll be invited to install the Scala plugin (upper right corner). +## Install the Scala plugin. + +Open up the `Ev3ScalaExample/src/ev3dev4s/examples/FiveXHelloWorld.scala` file. (It will look monochrome.) You'll be invited to install the Scala plugin (upper right corner). Install Scala Plugin -> OK From the popup in the lower right, restart Intellij to get the Scala plugin going. (It will keep offering the plugin until you do). In the upper right + * Set Up JDK -> * Version 11, Eclipse Temurin 11.0.16 -> * OK In the upper right: + * Set Up Scala SDK -> * Use Library -> * Create -> * Download 2.13.x (i.e. the latest in the version 2 branch -- NOT VERSION 3) -> * OK (installs files) -> * OK (activates plugin) - + ## Have Intellij understand the project structure Start a terminal window (by launching the Terminal app or clicking the terminal button `[>_]` in the lower left sidebar). + Run this command to set up for mill in intellij (So that intellij will know how everything hangs together): ``` ./millw mill.bsp.BSP/install ``` @@ -43,13 +46,13 @@ In intellij's terminal, remove the .idea directory (`rm -rf .idea`) ``` mv .idea /tmp/dot-idea-away ``` -Close intellij. Reopen it. +Close intellij. Reopen it. * Click File -> New -> Project from Existing Sources * navigate to the ev3dev-lang-scala directory (possibly in your home directory under `IdeaProjects`) * Select "Import project from external model" -> BSP -> Create -Test that you can navigate in the source code. +Test that you can navigate in the source code: * Open up `Ev3ScalaExample/src/ev3dev4s/examples/FiveXHelloWorld.scala` * place the cursor into the word "Sound" inside the `run` method @@ -61,19 +64,21 @@ It should open the Ev3KeyPad.scala file. # Moving compiled code to the Ev3 -(Always change the Ev3 password from the default `maker`) +The default network name for the EV3 is `ev3dev.local`; if you have renamed it, say, "firefly" then its network name will be `firefly.local`. -## Build and upload the Ev3LangScala library (Do this if you change the code library - first and rarely) +Always change the Ev3 password from the default `maker`. Using [good history option practices](https://tinyurl.com/histignorespace), set environment variables to hold the password and hostname: ` EV3PASS=yourpassword; EV3HOST=yourbrickname.local` (note the space at start of line). -```./millw -D ev3Password=maker Ev3LangScala.AppToRobot``` +## Upload the MasterPiece bash file (Probably once) -## Build and upload the MasterPiece library (Do this every time you want to see your addtions to the team's code run in the Ev3) +```./millw -D ev3Password="$EV3PASS" -D ev3Hostname="$EV3HOST" Ev3LangScalaExample.DoItToRobot``` -```./millw -D ev3Password=maker Ev3LangScalaExample.ToRobot``` +## Build and upload the Ev3LangScala library. Do this at least once and following any changes to the code library (anything in the Ev3LangScala directory) -## Upload the MasterPiece bash file (Probably once) +```./millw -D ev3Password="$EV3PASS" -D ev3Hostname="$EV3HOST" Ev3LangScala.AppToRobot``` + +## Build and upload the MasterPiece library. Do this every time you want to see your addtions to the team's code run in the Ev3 (eg if you're using the examples, anything in the Ev3LangScalaExamples directory). -```./millw -D ev3Password=maker Ev3LangScalaExample.DoItToRobot``` +```./millw -D ev3Password="$EV3PASS" -D ev3Hostname="$EV3HOST" Ev3LangScalaExample.ToRobot``` --- @@ -83,19 +88,24 @@ Intellij Idea will let you open up a second terminal with the big +, so you can ## Shell into the Ev3 -The default network name for the EV3 is `ev3dev.local` (used in these examples); if you have renamed it, say, "firefly" it will be `firefly.local`. Use ssh to connect +Use ssh to connect: -```ssh robot@ev3dev.local``` +```ssh robot@$EV3HOST``` -Enter your password when prompted and confirm you are sure you want to continue connecting. +Enter your password when prompted, and confirm you are sure you want to continue connecting. -Run in the shell +Run in the shell: -```brickrun -r -- java -cp Ev3LangScala.jar ev3dev4s.JarRunner Ev3LangScalaExample.jar examples.HelloWorld``` +```brickrun -r -- java -cp Ev3LangScala.jar ev3dev4s.JarRunner Ev3LangScalaExample.jar ev3dev4s.examples.FiveXHelloWorld``` -(It will blink green for about 45 seconds before honking and starting) +It will blink green for about 45 seconds before honking twice and starting the program. The example programs include -When you're done, +* FiveXHelloWorld -- how the robot can communicate back to you +* AllGadgetsExample -- reading information from the sensors and motors +* MotorExample -- drives the motors +* KitchenSink (in development) -- Does all of those + +When you're done, ```exit``` @@ -108,4 +118,3 @@ In the ev3dev OS menu on the Ev3 File Browser -> MasterPiece.bash* (It will blink green for about 45 seconds before honking and starting) -