CC3000 wifi shield+ arduino cannot connect to blynk

ok so, i am trying this simple code to connect my arduino mega+ CC3000 to my wifi hotspot and connect it to blynk. no matter what i do i cannot get it to work. i open hotspot, it connects to hotspot, the buildtest example is running fine, no errors, it gets the IP all fine. it will just not connect to blynk.
any solutions?

EDIT: it prints “invalid auth token”, i have copied and pasted it.
EDIT2: after a seiries of bad luck, some bad memory and a burned power supply i got a new arduino mega. now Blynk.begin() does not even start.

(i got the same result with my uno)

   #define ADAFRUIT_CC3000_IRQ   3
    #define ADAFRUIT_CC3000_VBAT  5
    #define ADAFRUIT_CC3000_CS    10

    #include <SPI.h>
    #include <Adafruit_CC3000.h>
    #include <BlynkSimpleCC3000.h>

    char auth[] = "myauth";

    void setup() {
    Serial.begin(9600);
    Blynk.begin(auth, "myssid", "mypass", WLAN_SEC_WPA2); 
      
    }

    void loop() {
    Blynk.run();
    }

When you copy and paste the token in, are you leaving the " quotation marks there? I think you need them. Maybe someone else can confirm. Something to try anyway.

it looks like

char auth[] = "1hug3455numb3r4nd500n"; //example number

““1hug3455numb3r4nd500n”” does not work, without the “” totally doesn’t work.

maybe my cc3000 just sends wrong credentials?

This might be a stupid question, but did you generated an auth token on the app and is the app connecting to Blynk correctly with your user credentials?

i did generate, phone is connected to 3G, logged in to the app, everything is fine. except that.

That is pretty weird than. Did you double check if your auth token matches that of the app (via the Nut icon in your dashboard)?

i sent an email, copied, pasted, and checked. :confused:

The only thing I can imagine, but also not very likely, is that your wifi shield or arduino is defective, but since you can upload sketches fine, I’d suspect the wifi shield.

Did you run other network examples from the adafruit library and do those work with network connectivity?

as i said i run the “buildtest” example of cc3000.

Hello, CC3000!

RX Buffer : 131 bytes
TX Buffer : 131 bytes
Free RAM: 1208

Initialising the CC3000 ...
Firmware V. : 1.26
MAC Address : 0x00 0x19 0x94 0x36 0x6D 0xD6
Networks found: 6
================================================
SSID Name    : UNITE-Staff
RSSI         : 46
Security Mode: 0

SSID Name    : uS-Studentcom
RSSI         : 47
Security Mode: 0

SSID Name    : 
RSSI         : 47
Security Mode: 3

SSID Name    : UNITE-Corporate
RSSI         : 46
Security Mode: 3

SSID Name    : Dontia
RSSI         : 69
Security Mode: 3

SSID Name    : HP-Print-6D-ENVY 4500 series
RSSI         : 35
Security Mode: 0

================================================

Deleting old connection profiles

Attempting to connect to Dontia
Connected!
Request DHCP
Unable to retrieve the IP Address!


IP Addr: 192.168.43.68
Netmask: 255.255.255.0
Gateway: 192.168.43.1
DHCPsrv: 192.168.43.1
DNSserv: 192.168.43.1
www.adafruit.com -> 141.101.113.175

Pinging 141.101.113.175...5 replies
Ping successful!


Closing the connection

Than I honestly have no idea what’s wrong. Maybe @vshymanskyy has an idea, he’s the guru :wink:

-edit

The Blynk team should also be able to check the log files, if you connect to cloud.blynk.cc

for some reason it fixed itself(?) i rest my case maybe my shield is weird afterall, if it acts strangely again i’ll definitely know i suppose… maybe it was the phone’s (server) fault too, i tinkered a bit connecting my phone to my computer and vice versa to see what happened, after that when i retried cc3000 to phone it just worked for some reason.

edit: WAS… i will never know what is going on… now it says “invalid token” again
edit2: ok i DO know what is going on. it has nothing to do with hardware on network.

apparently i forgot somewhere a pinMode() that for some reason disrupts the process even though i use pins 30 to 45ish and shouldn’t(?)

I think I heard other people about that too. There are a couple pins reserved for stuff, but as you mentioned, 30 - 45 shouldn’t be in that range I think. You could try others, but I suppose that wouldn’t matter.

First thing I like to do is exclude hardware problems and wiring issues, but with a shield that should be ok. PinMode shouldn’t be really needed, but it is the correct way to do things and I like to be correct when it comes to coding :wink:

after further testing, it matters if blynk is initialized before or after pinMode. blynk must always be last so far

Hmm, ok. I’ve written quite some lines for my Mega overhere: Home Domotics and I do pinMode after blynk.begin(), but then again, I’m using the ethernet shield so it may be something in the library for the shield.

it seems like a memory problem, i declared a char[]=“hello there!” around that and it prints as a “hAllo there!” or “h@llo there!” or cc3000 is faulty and sends wrong data from time to time.

Edit: it seems my UNO has some bad memory, #themoreyouknow, still doesn’t explain why i got the invalid token on mega before? maybe i had just bad luck?

Bad luck happens to the best of us. To exclude bad luck I’d advise you to get a cheap ESP-01 and try with that :slight_smile:

To me it seems that cc3000 was a mistake :slight_smile:
Such a buggy chip…

sigh
new arduino mega this time. now Blynk.begin() does not even start.
this is getting so bad it’s hilarious