I am a newbie (only 8 photons so far, and counting). I am trying to move up from the Web IDE so I can use the new particle debugger I bought and get to the next level.
I installed MS Visual Studio Code and added the Particle extensions, but when I went to create a new project I got the error messages that I copied below… I seemed to be missing something called lodash. I tried reinstalling the latest tool chain, but it made no difference. I am trying to create new project, but Workbench keeps telling me file not found - even thought it is clearly there in Windows explorer. and shows up in the path displayed by Workbench.
I am stuck. Can someone point me a way forward?
Thanks
Chris
Error in particle-cli:
! Cannot find module ‘lodash’
! See C:\Users\Chris\AppData\Local\particle\error.log for more info.
Error: Command failed with exit code 1 (Unknown system error -1): c:\Users\Chris.vscode\extensions\particle.particle-vscode-core-1.8.1\src\cli\bin\windows\amd64\particle.exe project create --name PlayWithButton c:\Users\Chris\Documents\PhotonProjects --no-update-check
at makeError (c:\Users\Chris.vscode\extensions\particle.particle-vscode-core-1.8.1\node_modules\execa\lib\error.js:59:11)
at handlePromise (c:\Users\Chris.vscode\extensions\particle.particle-vscode-core-1.8.1\node_modules\execa\index.js:112:26)
at async c:\Users\Chris.vscode\extensions\particle.particle-vscode-core-1.8.1\src\commands\lib\create-project.js:55:11
I open the Create New Project dialog box and am asked to "Choose project’s parent folder. I am not sure which it is looking for - FirstPhotonProject its parent PhotonProjects. I have tried both with no success. When I select FirstPhotonProject I get the message that no items match your search, although it is right there on the screen and selected. I get the error message that says Unable to create project. When I view the log I get the messages that I submitted in my first question.
I am sure I am doing something stupid, but I have no clue what it is, because I have tried everything I can think of. Also, the message saying that the “lodash” file can’t be found seems to me to indicate something is wrong with my setup.
Thank you for sending detailed instructions, which I followed carefully and all seems well now. But I still haven’t made it to my objective, which is to print to my cmd terminal so I can troubleshoot my code by printing to the serial monitor. The device seems to be on COM11, which windows shows as the only one that is open. I am concerned about the yellow ! which seems to indicate a problem with COM11, but I don’t know what to do next.
Could you send me some more detailed instructions that a newbie like myself can follow to get the serial port on the photon talking to the cmd serial monitor?
Thanks for the prompt response.
I turned off all my other Protons as in the attached screen shot, and tried the serial monitor with the --follow option and the cmd hung after saying polling for available serial device . . . and apparently finding nothing. Restarted cmd with the same result. Windows still only shows on port - COM11. I have included the code that shows I am using Serial.begin(9600); to set up the com port.
While this is a good trouble shooting step, I still will need a more robust solution because as you can see, I am trying to set up a server for a client-server arrangement where multiple clients report into the server. I have been limping along with Publish as a trouble shooting tool, but that is quite limited because of the limit per published events per second. I really need a good trouble shooting solution if I am going to venture into TCP client server stuff with my limited knowledge.
I have yet to try your suggestion about DFU Mode because I have never ventured into the realm, but I do have documentation so I could get brave and try it. But I am working hard to master one area before going into a new one and getting in over my head. I view the whole exercise as a learning experience and refuse to get frustrated by my many failure. As they say, SUCCESS is the result of many FAILURES!
Thanks for your help,
Chris
// THIS IS THE SERVER CODE FOR SBR
int ledPin=D7;
char SSIDBuffer[32];
TCPClient client;
TCPServer server=TCPServer(80); //port 80
byte dataBuffer[32];
boolean myWiFiIsOn=FALSE;
void setup() {
server.begin();
Serial.begin(9600);
//add a 30 second delay to give time to start up monitor in CLI
waitFor(Serial.isConnected, 30000);
Serial.println("Starting setup in server");
myWiFiIsOn=CheckMyWiFi();
pinMode(ledPin,OUTPUT);
}
void loop() {
int count=1;
Serial.println("Starting Server Loop");
delay(100);
client.read(dataBuffer,sizeof(dataBuffer));
for(int ptr=0;dataBuffer[ptr]!=0x00;ptr++){
Serial.print(char(dataBuffer[ptr]));
}
Serial.println();
client.println("SBRPhoton2");
}
boolean CheckMyWiFi(){
boolean wifiOn=FALSE;
wifiOn=WiFi.ready();
if(wifiOn){
Serial.println("WiFi is On");
Serial.print("SSID= ");
Serial.println(WiFi.SSID());
Serial.print("Local IP address= ");
Serial.println(WiFi.localIP());
}
}
I stumbled upon the same conclusion. If COM11 was my Photon, then it should have disappeared when they were taken off line. You are right on about a problem with the USB cord. I moved my InternetButton(more portable than my breadboard) to a different USB hub and guess wha?t - Photon Serial (COM10) showed up. I included a little snippet in the scren shot below. So now I know what to troubleshoot, so I think I can get to the next step as soon as I have time. Maybe breakfast first?
Thank you so much for all your help. You got to love us newbies. We are so clueless! But with help from you folks, we can learn. (I hope!)
Thanks. I uninstalled it and we shall see what happens. This raises a question? If a Photon is connected to the to the internet using the WiFi able to support a serial connection to print to CLI? Or do I need to actually plug the microUSB cable into the Photon.? I think I was assuming that the serial port would work thru the WiFI. Silly me!
I did a little trouble shooting and found that the long USB cable to my breadboard area had come loose from the port on the back of my PC. All is well now.
Now I can go back to trying to figure out how to connect my cmd CLI to connect to the proper COM port inorder to receive my debugging Serial.println’s. YES! It is working now.
Nope, USB Serial is a purely wired interface.
However, you can use TCP or UDP communication within your WiFi network (and beyond if security is of no concern).
Thank you for confirming that. The project I am working on as I learn the CLI and hopefully Workbench is a TCP/IP Client Server arrangement where one Photon acts as the server for a client, or when I get that far, a number of clients that will take various measurements around my home.
But before I get that project going I need to learn about the various tools at my disposal for writing, flashing and debugging my code. I have been using the Wed IDE and trying to get the CLI to read my debugging serial.prints. I am hoping to gain enough knowledge to move up to Workbench, but have faced some challenges there as well. If anybody has any suggestions about how best to learn to use these tools, I would appreciate it. I am NOT in a hurry to finish the project, but am using it as an exercise to learn. Hence my appreciation to all the people who have added their comments and helpful suggestions that have moved my learning process forward.
I did something similar as a learning exersize, except I installed a MQTT broker locally on a RaspberryPi and used the MQTT library on each device. It hides lots of the TCP Client server stuff (which for me was not the focus) but I did get data streams going easily and quickly and I then used MySQL and a simple JS web GUI to show the data.
I took a leap of faith to Workbench and after following this guide, Its all I use now
Thanks for the tip. I am determined to master Workbench, as you suggested.
I got the tutorial and am going thru it section by section and trying it on my copy of Workbench. But when I got to the section on Cloud build and flash I got stuck: From the Command Palette select Particle: Configure Workspace for Device ., I got the message that there was no such command. Is there an issue with the Tutorial (perhaps not up to date) or is there are problem with my version of Workbench, or just ME
I see a command Configure Project for Device. I I do that, am I going to be OK without the other command?
Also, I want to make sure that building in the cloud is the best choice for a newby like me.
That command was renamed to Configure Project for Device quite some time ago.
Obviously that didn't punch through to that tutorial tho'
It will definetly be faster than local builds (especially when using Windows) and as long you have internet connectivity and don't need to tweak the device OS cloud building is a good choice.