Jump to content
ELFORUM - Forumul electronistilor

Bascom _ Arduino Nano


Recommended Posts

Reusesc sa "programez" Arduino direct din Bascom via USB si merge bine asta...... un mic exemplu cu led-ul din dotare din portb.5:

$regfile = "M328pdef.dat"
$crystal = 16000000

Config Pinb.5 = Output
Led Alias Portb.5
Led = 1

Do

Led = 0
Waitms 500
Led = 1
Waitms 500

Loop

End

 

Ledul clipeste dupa programare....

Merge ceva si invers...:

$regfile = "M328pdef.dat"
$crystal = 16000000
$baud = 9600
Dim I As Byte

Do

For I = 1 To 10
Print I
Wait 1

Next I

Loop

 

In "Terminal Emulator" afisaza 1,2,3.... etc

Deci Arduino comunica cu PC-ul doar cu ajutorul Bascom

 

 

Acum urmeaza problema mea, am facut in VisualBasic un "programel" (exemplu de pe net:   https://www.youtube.com/watch?v=AS5vQKj6Ykw) cu doua butoane, LedOn - LedOff care asta as vrea sa faca sa-mi aprinda/stinga led-ul din portb5

Cand apas butoanele in Arduino se vad ledurile Rx/Tx clipind deci cred ca semnal primeste insa nu ma pricep cum sa fac programul in Bascom sa faca asta?

Am incercat multe insa sa incepem cu asta:

$regfile = "M328pdef.dat"
$crystal = 16000000
$baud = 9600
Dim Ledin As Byte

 

Input Ledin


do

If Ledin = 1 Then Led = 1
If Ledin = 0 Then Led = 0

Waitms 10

Loop

end

 

 

 

Tot ce am incercat nu merge asa ca va rog sa-mi dati idei.

Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Intre timp ca sa fie problema completa nu mi-a mers Arduino... :)    Aveam versiunea cea mai recenta instala si nu puteam programa Arduino Nano.....

Am instalat o versiune mai veche (1.6) care a mers fara probleme, am urcat programelul in Nano:

void setup()
{
 pinMode (13,OUTPUT);
 Serial.begin(9600);
}
 
void loop()
{
  int value;
  if(Serial.available())
  {
    delay(50);
    while(Serial.available() >0)
    {
      value=Serial.read();
      if(value=='1'){digitalWrite(13,HIGH);}
      else if (value=='0') {digitalWrite (13,LOW);
      }
    }
  }
}

 

Iar cu micul soft facut in VB8 pot aprinde/stinge ledul din Nano astfel am confirmarea ca totul functioneaza.

 

Acum o sa vad daca reusesc si in Bascom.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines