element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Help needed! Arduino output to app inventor 2 input via bluetooth.
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 1 reply
  • Subscribers 389 subscribers
  • Views 269 views
  • Users 0 members are here
  • appinventor2
  • bluetooth
  • mit_app_inventor
  • arduino
  • input/output
Related

Help needed! Arduino output to app inventor 2 input via bluetooth.

Former Member
Former Member over 10 years ago

I need help figuring out how to revieve an input on an app inventor app from an arduino via bluetooth. i already have outputs from appinventor to arduino but now need to reverse that for about 5 inputs to the app. the problem is whatever i seem to do the app or arduino is not translating the data correctly and will not read the input and there for will not show a picture that it is suppose to when a certain input is recieved. Please help. Very important project for work and almost done! Nedd help ASAP!

 

here is the arduino code.

 

 

int AUTO = 13;

int pp = 12;

int slider = 11; //pwm

int manUp = 10;

int manDown = 9;

int cal = 8;

int value = 52;

int testButton1 = 2;

int val1 = 49;

String readString;

 

 

void setup()

{

  Serial.begin(9600);

  pinMode(AUTO, OUTPUT);

  pinMode(pp, OUTPUT);

  pinMode(slider, OUTPUT);

  pinMode(manUp, OUTPUT);

  pinMode(manDown, OUTPUT);

  pinMode(cal, OUTPUT);

  pinMode(testButton1, INPUT);

  analogWrite(slider, value); //default standoff = 1mm

  value = -1;

}

 

 

 

 

 

 

void loop()

{

  while (Serial.available())

  {

    delay(3);

    value = Serial.read();

    char c = Serial.read();

    readString += c;

    if (value >= 50)

    {

      Serial.println(value);

      analogWrite(slider, value);

 

 

    }

    if (value == 33)

    {

      digitalWrite(AUTO, HIGH);

    }

    if (value == 34)

    {

      digitalWrite(AUTO, LOW);

    }

    if (value == 36)

    {

      digitalWrite(pp, HIGH);

    }

    if (value == 37)

    {

      digitalWrite(pp, LOW);

    }

    if (value == 38)

    {

      digitalWrite(manUp, HIGH);

    }

    if (value == 39)

    {

      digitalWrite(manUp, LOW);

    }

    if (value == 40)

    {

      digitalWrite(manDown, HIGH);

    }

    if (value == 41)

    {

      digitalWrite(manDown, LOW);

    }

    if (value == 35)

    {

      digitalWrite(cal, HIGH);

      delay (200);

      digitalWrite(cal, LOW);

    }

  }

 

  val1 = digitalRead(testButton1);

  if (val1 == HIGH)

  {

    Serial.println(val1);

    delay(500);

  }

}

 

 

 

Heres the app.

 

 

image

  • Sign in to reply
  • Cancel
Parents
  • neilk
    0 neilk over 10 years ago

    Hi wsallee07

     

    Looking quickly at your AppInventor blocks of code, I can't decide if you are expecting to receive text or an unsigned 1 byte number - you appear to be trying to do both

     

    There are code blocks receiving for text and code blocks for receiving numbers in the Bluetooth section. I have never tried to mix them; I don't think it will work if you do.

     

    Hope this helps

     

    Neil

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • neilk
    0 neilk over 10 years ago

    Hi wsallee07

     

    Looking quickly at your AppInventor blocks of code, I can't decide if you are expecting to receive text or an unsigned 1 byte number - you appear to be trying to do both

     

    There are code blocks receiving for text and code blocks for receiving numbers in the Bluetooth section. I have never tried to mix them; I don't think it will work if you do.

     

    Hope this helps

     

    Neil

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube