JS package not working with Rails 7 importmap - ruby-on-rails-7

I have a Rails 7 app that is trying to use the #walletconnect/web3-provider npm package. After running ./bin/importmap pin #walletconnect/web3-provider#1.7.5, a bunch of JS modules get pinned in importmap.rb:
pin "#walletconnect/web3-provider", to: "https://ga.jspm.io/npm:#walletconnect/web3-provider#1.7.5/dist/esm/index.js"
pin "#walletconnect/browser-utils", to: "https://ga.jspm.io/npm:#walletconnect/browser-utils#1.7.8/dist/esm/index.js"
pin "#walletconnect/client", to: "https://ga.jspm.io/npm:#walletconnect/client#1.7.8/dist/esm/index.js"
pin "#walletconnect/core", to: "https://ga.jspm.io/npm:#walletconnect/core#1.7.8/dist/esm/index.js"
pin "#walletconnect/crypto", to: "https://ga.jspm.io/npm:#walletconnect/crypto#1.0.2/dist/esm/browser/index.js"
pin "#walletconnect/encoding", to: "https://ga.jspm.io/npm:#walletconnect/encoding#1.0.1/dist/esm/index.js"
pin "#walletconnect/environment", to: "https://ga.jspm.io/npm:#walletconnect/environment#1.0.0/dist/cjs/index.js"
pin "#walletconnect/http-connection", to: "https://ga.jspm.io/npm:#walletconnect/http-connection#1.7.8/dist/esm/index.js"
pin "#walletconnect/iso-crypto", to: "https://ga.jspm.io/npm:#walletconnect/iso-crypto#1.7.8/dist/esm/index.js"
pin "#walletconnect/jsonrpc-types", to: "https://ga.jspm.io/npm:#walletconnect/jsonrpc-types#1.0.1/dist/esm/index.js"
pin "#walletconnect/jsonrpc-utils", to: "https://ga.jspm.io/npm:#walletconnect/jsonrpc-utils#1.0.3/dist/esm/index.js"
pin "#walletconnect/qrcode-modal", to: "https://ga.jspm.io/npm:#walletconnect/qrcode-modal#1.7.8/dist/cjs/index.js"
pin "#walletconnect/randombytes", to: "https://ga.jspm.io/npm:#walletconnect/randombytes#1.0.2/dist/esm/browser/index.js"
pin "#walletconnect/safe-json", to: "https://ga.jspm.io/npm:#walletconnect/safe-json#1.0.0/dist/esm/index.js"
pin "#walletconnect/socket-transport", to: "https://ga.jspm.io/npm:#walletconnect/socket-transport#1.7.8/dist/esm/index.js"
pin "#walletconnect/utils", to: "https://ga.jspm.io/npm:#walletconnect/utils#1.7.8/dist/esm/index.js"
pin "#walletconnect/window-getters", to: "https://ga.jspm.io/npm:#walletconnect/window-getters#1.0.0/dist/cjs/index.js"
pin "#walletconnect/window-metadata", to: "https://ga.jspm.io/npm:#walletconnect/window-metadata#1.0.0/dist/cjs/index.js"
pin "bn.js", to: "https://ga.jspm.io/npm:bn.js#4.11.8/lib/bn.js"
pin "buffer", to: "https://ga.jspm.io/npm:#jspm/core#2.0.0-beta.24/nodelibs/browser/buffer.js"
pin "cookiejar", to: "https://ga.jspm.io/npm:cookiejar#2.1.3/cookiejar.js"
pin "copy-to-clipboard", to: "https://ga.jspm.io/npm:copy-to-clipboard#3.3.1/index.js"
pin "decode-uri-component", to: "https://ga.jspm.io/npm:decode-uri-component#0.2.0/index.js"
pin "detect-browser", to: "https://ga.jspm.io/npm:detect-browser#5.2.0/index.js"
pin "dijkstrajs", to: "https://ga.jspm.io/npm:dijkstrajs#1.0.2/dijkstra.js"
pin "eventemitter3", to: "https://ga.jspm.io/npm:eventemitter3#4.0.7/index.js"
pin "http", to: "https://ga.jspm.io/npm:#jspm/core#2.0.0-beta.24/nodelibs/browser/http.js"
pin "https", to: "https://ga.jspm.io/npm:#jspm/core#2.0.0-beta.24/nodelibs/browser/https.js"
pin "is-typedarray", to: "https://ga.jspm.io/npm:is-typedarray#1.0.0/index.js"
pin "isarray", to: "https://ga.jspm.io/npm:isarray#2.0.5/index.js"
pin "js-sha3", to: "https://ga.jspm.io/npm:js-sha3#0.8.0/src/sha3.js"
pin "os", to: "https://ga.jspm.io/npm:#jspm/core#2.0.0-beta.24/nodelibs/browser/os.js"
pin "preact", to: "https://ga.jspm.io/npm:preact#10.4.1/dist/preact.module.js"
pin "preact/compat", to: "https://ga.jspm.io/npm:preact#10.4.1/compat/dist/compat.module.js"
pin "preact/hooks", to: "https://ga.jspm.io/npm:preact#10.4.1/hooks/dist/hooks.module.js"
pin "process", to: "https://ga.jspm.io/npm:#jspm/core#2.0.0-beta.24/nodelibs/browser/process-production.js"
pin "qrcode", to: "https://ga.jspm.io/npm:qrcode#1.4.4/lib/browser.js"
pin "qrcode/lib/utils/buffer.js", to: "https://ga.jspm.io/npm:qrcode#1.4.4/lib/utils/typedarray-buffer.js"
pin "query-string", to: "https://ga.jspm.io/npm:query-string#6.13.5/index.js"
pin "split-on-first", to: "https://ga.jspm.io/npm:split-on-first#1.1.0/index.js"
pin "strict-uri-encode", to: "https://ga.jspm.io/npm:strict-uri-encode#2.0.0/index.js"
pin "toggle-selection", to: "https://ga.jspm.io/npm:toggle-selection#1.0.6/index.js"
pin "typedarray-to-buffer", to: "https://ga.jspm.io/npm:typedarray-to-buffer#3.1.5/index.js"
pin "url", to: "https://ga.jspm.io/npm:#jspm/core#2.0.0-beta.24/nodelibs/browser/url.js"
pin "xhr2-cookies", to: "https://ga.jspm.io/npm:xhr2-cookies#1.1.0/dist/index.js"
I import the package in application.js:
import "#walletconnect/web3-provider"
And then I try to import a specific module in my custom JS file (which is also imported in application.js):
import WalletConnectProvider from "#walletconnect/web3-provider";
When I start the server and visit the site in the browser, it shows following error:
Uncaught SyntaxError: The requested module 'js-sha3' does not provide an export named 'keccak_256' (at index.js:1:189)
I don't understand why this error is happening. When I look at the js-sha3 repo, I see that keccak_256 is exported here. So, why is this error happening?
Thanks!

What you linked to is a TS type definition. It has no runtime effect. It's just there for type hints in your editor.
That package is only distributed as CJS -- there are no exports, and you cannot use it without a bundler. Using it directly in the browser (as you attempt to) will not work.

Related

Couldn't find any packages in ["react-redux#7.2.5"] on jsdelivr

I am migrating an already existing Rails/React app from webpacker to Rails7/importmaps/jsbundling-rails.
As I am pining the dependent node packages I receive these:
Couldn't find any packages in ["redux-form#8.3.7"] on jsdelivr
~/p/r/h/ReactBikes rails-7-impo…s-jsbundling ❯ ./bin/importmap pin reactstrap#8.10.0 --from jsdelivr
Couldn't find any packages in ["reactstrap#8.10.0"] on jsdelivr
~/p/r/h/ReactBikes rails-7-impo…s-jsbundling ❯ ./bin/importmap pin react-redux#7.2.5 --from jsdelivr
Couldn't find any packages in ["react-redux#7.2.5"] on jsdelivr
~/p/r/h/ReactBikes rails-7-impo…s-jsbundling ❯
However on jsdeliver the packages with the given version exists:
https://www.jsdelivr.com/package/npm/reactstrap?version=8.10.0
https://www.jsdelivr.com/package/npm/redux-form?version=8.3.7
https://www.jsdelivr.com/package/npm/react-redux?version=7.2.5
This is my importmap.rb file:
# Pin npm packages by running ./bin/importmap
pin "application", to:"/assets/application.js", preload: true
pin "axios", to: "https://cdn.jsdelivr.net/npm/axios#0.22.0/index.js"
pin "bootstrap", to: "https://cdn.jsdelivr.net/npm/bootstrap#5.1.2/dist/js/bootstrap.esm.js"
pin "#popperjs/core", to: "https://cdn.jsdelivr.net/npm/#popperjs/core#2.11.6/lib/index.js"
pin "prop-types", to: "https://cdn.jsdelivr.net/npm/prop-types#15.8.1/index.js"
pin "react", to: "https://cdn.jsdelivr.net/npm/react#17.0.2/index.js"
pin "react-day-picker", to: "https://cdn.jsdelivr.net/npm/react-day-picker#7.4.10/lib/react-day-picker.min.js"
pin "react-dom", to: "https://cdn.jsdelivr.net/npm/react-dom#17.0.2/index.js"
pin "react-google-maps", to: "https://cdn.jsdelivr.net/npm/react-google-maps#9.4.5/lib/index.js"
pin "react-hot-loader", to: "https://cdn.jsdelivr.net/npm/react-hot-loader#4.13.0/index.js"
pin "react-rater", to: "https://cdn.jsdelivr.net/npm/react-rater#5.1.1/lib/index.js"
pin "react-router-dom", to: "https://cdn.jsdelivr.net/npm/react-router-dom#5.3.0/esm/react-router-dom.js"
pin "#babel/runtime/helpers/esm/extends", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/extends.js"
pin "#babel/runtime/helpers/esm/inheritsLoose", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/inheritsLoose.js"
pin "#babel/runtime/helpers/esm/objectWithoutPropertiesLoose", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/objectWithoutPropertiesLoose.js"
pin "history", to: "https://cdn.jsdelivr.net/npm/history#4.10.1/esm/history.js"
pin "hoist-non-react-statics", to: "https://cdn.jsdelivr.net/npm/hoist-non-react-statics#3.3.2/dist/hoist-non-react-statics.cjs.js"
pin "mini-create-react-context", to: "https://cdn.jsdelivr.net/npm/mini-create-react-context#0.4.1/dist/esm/index.js"
pin "path-to-regexp", to: "https://cdn.jsdelivr.net/npm/path-to-regexp#1.8.0/index.js"
pin "react-is", to: "https://cdn.jsdelivr.net/npm/react-is#16.13.1/index.js"
pin "react-router", to: "https://cdn.jsdelivr.net/npm/react-router#5.2.1/esm/react-router.js"
pin "resolve-pathname", to: "https://cdn.jsdelivr.net/npm/resolve-pathname#3.0.0/esm/resolve-pathname.js"
pin "tiny-invariant", to: "https://cdn.jsdelivr.net/npm/tiny-invariant#1.2.0/dist/tiny-invariant.esm.js"
pin "tiny-warning", to: "https://cdn.jsdelivr.net/npm/tiny-warning#1.0.3/dist/tiny-warning.esm.js"
pin "value-equal", to: "https://cdn.jsdelivr.net/npm/value-equal#1.0.1/esm/value-equal.js"
pin "react-select", to: "https://cdn.jsdelivr.net/npm/react-select#5.1.0/dist/react-select.esm.js"
pin "#babel/runtime/helpers/defineProperty", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/defineProperty.js"
pin "#babel/runtime/helpers/esm/classCallCheck", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/classCallCheck.js"
pin "#babel/runtime/helpers/esm/createClass", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/createClass.js"
pin "#babel/runtime/helpers/esm/defineProperty", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/defineProperty.js"
pin "#babel/runtime/helpers/esm/inherits", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/inherits.js"
pin "#babel/runtime/helpers/esm/objectWithoutProperties", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/objectWithoutProperties.js"
pin "#babel/runtime/helpers/esm/slicedToArray", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/slicedToArray.js"
pin "#babel/runtime/helpers/esm/taggedTemplateLiteral", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/taggedTemplateLiteral.js"
pin "#babel/runtime/helpers/esm/toConsumableArray", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/toConsumableArray.js"
pin "#babel/runtime/helpers/esm/typeof", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/typeof.js"
pin "#babel/runtime/helpers/extends", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/extends.js"
pin "#babel/runtime/helpers/objectWithoutProperties", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/objectWithoutProperties.js"
pin "#babel/runtime/helpers/slicedToArray", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/slicedToArray.js"
pin "#babel/runtime/helpers/taggedTemplateLiteral", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/taggedTemplateLiteral.js"
pin "#babel/runtime/helpers/toConsumableArray", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/toConsumableArray.js"
pin "#babel/runtime/helpers/typeof", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/typeof.js"
pin "#emotion/cache", to: "https://cdn.jsdelivr.net/npm/#emotion/cache#11.10.1/dist/emotion-cache.browser.esm.js"
pin "#emotion/hash", to: "https://cdn.jsdelivr.net/npm/#emotion/hash#0.9.0/dist/emotion-hash.esm.js"
pin "#emotion/memoize", to: "https://cdn.jsdelivr.net/npm/#emotion/memoize#0.8.0/dist/emotion-memoize.esm.js"
pin "#emotion/react", to: "https://cdn.jsdelivr.net/npm/#emotion/react#11.10.0/dist/emotion-react.browser.esm.js"
pin "#emotion/serialize", to: "https://cdn.jsdelivr.net/npm/#emotion/serialize#1.1.0/dist/emotion-serialize.browser.esm.js"
pin "#emotion/sheet", to: "https://cdn.jsdelivr.net/npm/#emotion/sheet#1.2.0/dist/emotion-sheet.browser.esm.js"
pin "#emotion/unitless", to: "https://cdn.jsdelivr.net/npm/#emotion/unitless#0.8.0/dist/emotion-unitless.esm.js"
pin "#emotion/utils", to: "https://cdn.jsdelivr.net/npm/#emotion/utils#1.2.0/dist/emotion-utils.browser.esm.js"
pin "#emotion/weak-memoize", to: "https://cdn.jsdelivr.net/npm/#emotion/weak-memoize#0.3.0/dist/emotion-weak-memoize.esm.js"
pin "memoize-one", to: "https://cdn.jsdelivr.net/npm/memoize-one#5.2.1/dist/memoize-one.esm.js"
pin "stylis", to: "https://cdn.jsdelivr.net/npm/stylis#4.0.13/index.js"
pin "react-select2-wrapper", to: "https://cdn.jsdelivr.net/npm/react-select2-wrapper#1.0.4-beta6/lib/components/Select2.js"
pin "react-spinners", to: "https://cdn.jsdelivr.net/npm/react-spinners#0.11.0/index.js"
pin "-", to: "https://cdn.jsdelivr.net/npm/-#0.0.1/dist/index.js"
pin "react-toggle", to: "https://cdn.jsdelivr.net/npm/react-toggle#4.1.2/dist/component/index.js"
pin "redux", to: "https://cdn.jsdelivr.net/npm/redux#4.1.1/es/redux.js"
pin "#babel/runtime/helpers/esm/objectSpread2", to: "https://cdn.jsdelivr.net/npm/#babel/runtime#7.18.9/helpers/esm/objectSpread2.js"
pin "redux-react-session", to: "https://cdn.jsdelivr.net/npm/redux-react-session#2.6.1/dist/index.js"
pin "redux-thunk", to: "https://cdn.jsdelivr.net/npm/redux-thunk#2.3.0/es/index.js"
pin "title-case", to: "https://cdn.jsdelivr.net/npm/title-case#3.0.3/dist.es2015/index.js"
Why the importmap states that the redux-form#8.3.7 "reactstrap#8.10.0 and react-redux#7.2.5 couldn't be found on jsdeliver if they are there?

Pic12f683 only has digital out on pin 2 (GP5)

I've been trying to get started with the PIC12f683 in order to get familiar with the PIC family of microcontrollers.
I've got it hooked up to a Pickit 3, and talking to my PC, that all seems to work fine.
I've been trying various LED flasher examples from the internet but no matter which example code I try, or what I do with the TRISO or GPIO registers, I only get output on pin 2, none of the other GPIO pins will do anything.
Electrically speaking... Pins 1, 4, 6, 7, and 8 are connected to the Pickit for ICSP. Pins 2, 3, 5, and 7 have LEDs with 220 ohm resistors going from the pin to ground, and pins 1 and 8 are connected to a lithium ion battery (~3.7 v).
This is the code I am using currently.
#define _XTAL_FREQ 8000000
#include <xc.h>
// BEGIN CONFIG
// CONFIG
#pragma config FOSC = INTOSCIO // Oscillator Selection bits (INTOSCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = OFF // MCLR Pin Function Select bit (MCLR pin function is digital input, MCLR internally tied to VDD)
#pragma config CP = OFF // Code Protection bit (Program memory code protection is disabled)
#pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled)
#pragma config BOREN = OFF // Brown Out Detect (BOR disabled)
#pragma config IESO = OFF // Internal External Switchover bit (Internal External Switchover mode is disabled)
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enabled bit (Fail-Safe Clock Monitor is disabled)
//END CONFIG
int main()
{
TRISIO =0b00000000; //RB0 as Output PIN
GPIO = 0b00111111;
while(1)
{
GP5=1;
GP4=1;
GP0=1;
GP2=1;
__delay_ms(1000);
GP5=0;
GP4=0;
GP0=0;
GP2=0;
__delay_ms(1000);
}
return 0;
}
I believe the config portion was generated by MPlab, the rest is copied/modified from this instructable:
https://www.instructables.com/id/How-to-Blink-an-Led-With-PIC16F886-/
but the results are the same no matter what example code I use. I'm guessing there's a register or configuration variable I've set wrong somewhere, but I can't figure it out.
You had to switch your Outputs to digital.
int main()
{
TRISIO =0b00000000; //RB0 as Output PIN
ANSEL = 0; // all outputs digital !!!!!
CMCON0 = 0b00000111; //turn Cin Pins as I/O
GPIO = 0b00111111;
while(1)
{
GP5=1;
GP4=1;
GP0=1;
GP2=1;
__delay_ms(1000);
GP5=0;
GP4=0;
GP0=0;
GP2=0;
__delay_ms(1000);
}
return 0;
}
The outputs GP0 ... GP4 are default analog ones.
And please remember GP3 share the pin with MCLR, so it is an input only pin.

Error on sending AT+CWJAP_DEF commands to ESP8266

I am trying to send AT commands to ESP8266 to get connected with internet with the Wifi.
When I am sending AT and AT+RST command on serial monitor then I am getting OK and ready response which seems perfect.
Then I am sending AT+CWLAP to get list of available wifi networks which is also executing correctly.
AT+CWLAP
+CWLAP:(3,"Moto",-42,"a4:70:d6:7a:fa:6c",1,25,0)
+CWLAP:(4,"PRANJAL",-95,"1c:a5:32:3d:f5:c4",1,-16,0)
+CWLAP:(2,"VIHAN",-94,"c8:3a:35:2f:1d:81",1,-21,0)
+CWLAP:(3,"Tenda",-93,"c8:3a:35:20:a9:b1",9,-4,0)
OK
Then I sent AT+CWMODE? which is also perfect.
AT+CWMODE?
+CWMODE:1
OK
Now I am trying to connect ESP8266 with above listed Wifi with this command, it is sending an ERROR on serial monitor.
AT+CWJAP_DEF="Moto","reset1234"
Error
⸮=IRe"Moto","reset1234"
ERROR
Can anyone suggest me what could be the reason of this issue ?
#include "SoftwareSerial.h"
SoftwareSerial esp8266(2, 3); // RX, TX
void setup()
{
Serial.begin(9600); // serial port used for debugging
esp8266.begin(9600); // your ESP's baud rate might be different
}
void loop()
{
if(esp8266.available()) // check if the ESP is sending a message
{
while(esp8266.available())
{
char c = esp8266.read(); // read the next character.
Serial.write(c); // writes data to the serial monitor
}
}
if(Serial.available())
{
delay(10); // wait to let all the input command in the serial buffer
// read the input command in a string
String cmd = "";
while(Serial.available())
{
cmd += (char)Serial.read();
}
// send to the esp8266
esp8266.println(cmd);
}
}
The current official AT command set seems to be documented on https://github.com/espressif/ESP8266_AT/wiki/AT_Description
http://espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
https://www.itead.cc/wiki/ESP8266_Serial_WIFI_Module#AT_Commands
If the module is to be configured as a client, i.e. to connect to an access point, the following AT commands have to be sent (11500 baud 8N1, CR-LF line termination):
AT+RST
AT+CWMODE=3 (1 is "Station" only (wifi client), 3 is mixed mode "Station and Access-Point", both should work)
AT+CWJAP="Moto","reset1234"
AT+CWJAP_CUR="Moto","reset1234" (temporary) or
AT+CWJAP_DEF="Moto","reset1234" (stored)
For reference, a "success story" (ESP8266 module with USB-UART, Software: HTerm, Access Point with WPA2 (both TKIP / CCMP tested)):
AT<\r><\r><\n><\r><\n>
OK<\r><\n>
AT+RST<\r><\r><\n><\r><\n>
OK<\r><\n>
<\r><\n>
ets Jan 8 2013,rst cause:2, boot mode:(3,6)<\r><\n>
<\r><\n>
load 0x40100000, len 1856, room 16 <\r><\n>
tail 0<\r><\n>
chksum 0x63<\r><\n>
load 0x3ffe8000, len 776, room 8 <\r><\n>
tail 0<\r><\n>
chksum 0x02<\r><\n>
load 0x3ffe8310, len 552, room 8 <\r><\n>
tail 0<\r><\n>
chksum 0x79<\r><\n>
csum 0x79<\r><\n>
<\r><\n>
2nd boot version : 1.5<\r><\n>
SPI Speed : 40MHz<\r><\n>
SPI Mode : DIO<\r><\n>
SPI Flash Size & Map: 32Mbit(512KB+512KB)<\r><\n>
jump to run user1 # 1000<\r><\n>
<\r><\n>
??r?d?l<18>?<31><\0><\f>?l`<3>??s?l?<28>?<19>?<4><4><4>$ <2>??r?$<4>??<27>?<4><4>ll`<3>r$?<18>?"<\0>????"<4>l?cs|<\f>?`?22???<27>BB<18>c??o??<18>NN?<16><2><\0><2>d$??<2>d??<\0>?<4>d??<\0>ll????d??l`<2>?<2>N?<\0>????"<4>d??<28>p<4><4><2><2>???"b<4>$<4>?"prlrl<\r><\n>
Ai-Thinker Technology Co. Ltd.<\r><\n>
<\r><\n>
ready<\r><\n>
WIFI DISCONNECT<\r><\n>
AT+CWMODE?<\r><\r><\n>+CWMODE:3<\r><\n>
<\r><\n>
OK<\r><\n>
AT+CWJAP_CUR="Moto","reset1234"<\r><\r><\n>
WIFI CONNECTED<\r><\n>
WIFI GOT IP<\r><\n>
<\r><\n>
OK<\r><\n>
AT+CIFSR<\r><\r><\n>+CIFSR:APIP,"0.0.0.0"<\r><\n>
+CIFSR:APMAC,"00:00:00:00:00:00"<\r><\n>
+CIFSR:STAIP,"0.0.0.0"<\r><\n>
+CIFSR:STAMAC,"00:00:00:00:00:00"<\r><\n>
<\r><\n>
OK<\r><\n>
AT+GMR<\r><\r><\n>AT version:1.1.0.0(May 11 2016 18:09:56)<\r><\n>
SDK version:1.5.4(baaeaebb)<\r><\n>
Ai-Thinker Technology Co. Ltd.<\r><\n>
Jun 13 2016 11:29:20<\r><\n>
OK<\r><\n>
This also works with mode=1.
Major rewrite.
Questions and ideas to test:
what is your module firmware version?
access point issues (e.g. MAC address restrictions)?
power supply good?
might there be any old configuration or other code running on the module?
what is the byte code of ⸮ in the error message - Is it two bytes 0x2E2E?
are you using the Arduino serial monitor for communication?
in contrast to my comment, maybe the arduino does have an influence (timing?). Try to rule this out by
doing the pass-through character-based instead of line-based, e.g.:
(end of list, no code possible otherwise:)
loop(){
if( esp8266.available() )
Serial.write(esp8266.read());
if( Serial.available() )
esp8266.write(Serial.read());
}
keeping the AVR in reset and connecting the ESP8266 serial lines directly to the USB-UART converter
Alright! I just tried to connect with different wifi and it got connected with it. It was some kinda issue with mobile hotspot.

Interfacing with SparkFun mpu-6050 with a Texas Instruments TM4C123G LaunchPad

I am trying to interface with the MPU-6050 as part of a robotics project using the Texas Instruments TM4C123G LaunchPad. I am uploading code onto this from Energia and am using the serial monitor to see the raw data output, however I am only receiving the following output when I upload it to the micro controller and run it:
Initialising I2C devices...
Here is the code that I am trying to run:
#include <Wire.h>
#include <I2Cdev.h>
#include <MPU6050.h>
MPU6050 accelgyro;
void Setup_MPU6050()
{
Wire.begin();
Serial.println("Initialising I2C devices...");
accelgyro.initialize();
Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
}
void Update_MPU6050()
{
int16_t ax, ay, az;
int16_t gx, gy, gz;
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
Serial.print("i");Serial.print("\t");
Serial.print(ax);Serial.print("\t");
Serial.print(ay);Serial.print("\t");
Serial.print(az);Serial.print("\t");
Serial.print(gx);Serial.print("\t");
Serial.print(gy);Serial.print("\t");
Serial.println(gz);
Serial.print("\n");
}
void setup()
{
Serial.begin(115200);
Setup_MPU6050();
}
void loop()
{
Update_MPU6050();
}
The pins on the breakout board are connected to the Launchpad as follows:
VDD -> Pin 1 (3.3v)
GND -> Pin 12 (GND)
INT -> Pin 34 (PF0)
FSYNC -> None
SCL -> Pin 13 (PD0)
SDA - > Pin 14 (PD1)
VIO -> None
CLK -> None
ASCL -> None
ASDA -> None
I have got the MPU6050 and I2Cdev libraries from GitHub and have got the Wire library from github.com/codebendercc/arduino-library-files/blob/master/libraries/Wire/Wire.h but am thinking that either the wire.begin() or accelgyro.initialize() methods are not functioning properly? I am a relative beginner when it comes to programming in this language but I am undertaking an ambitious task to create a robot for a scholarship that I am applying for, and would therefore appreciate some assistance on this subject area.
I just met the same question as you. Here is a useful linkage:
enter link description here
I referred it and added some code before
Wire.begin()
--just like this
enter image description here
then I upload it and run, it works perfectly. And there is another thing to be minded that you can't connect INT pin when you don't use DMP but when you use DMP then you must connect INT pin.
I try to explain it.
Why should we add the two lines codes? The Library is from Arduino, although Energia is compatible with Arduino programming in most cases but not always. So we should explictly acclaim something.
And why should we pay attention the interruption. Because when we use DMP we use it, if we don't connect the INT pin, it willn't work normally.

Arduino builds fail with "Reset.h: No such file or directory"

When I'm trying to build what seems to be any code in the Arduino IDE, it fails with this error:
Arduino: 1.6.5 (Mac OS X), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/USBCore.cpp:19:19: fatal error: Reset.h: No such file or directory
#include "Reset.h"
^
compilation terminated.
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
The code I'm trying to build is from https://www.arduino.cc/en/Tutorial/Fade:
/*
Fade
This example shows how to fade an LED on pin 9
using the analogWrite() function.
The analogWrite() function uses PWM, so if
you want to change the pin you're using, be
sure to use another PWM capable pin. On most
Arduino, the PWM pins are identified with
a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
This example code is in the public domain.
*/
int led = 9; // the PWM pin the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 9:
analogWrite(led, brightness);
// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
Why is this happening? I don't think I've changed any of the Arduino libraries, but wondering if that's the case now. A find in /Applications/Arduino.app/ lists no files called Reset.h, however, I did find a ~/Library/Arduino15/packages/arduino/hardware/sam/1.6.4/cores/arduino/Reset.h.
Building with Arduino IDE 1.6.5, using a Mega 2560 and /dev/cu.usbmodem1421.
It turns out my Android installation was modified, and the modified USBCore.cpp wasn't really correct for this version (1.6.5) of Arduino. Reinstalling fixed the problem.

Resources