% MATLAB-Arduino Serial Port Monitor
clear
clc
% Defined Serial Port
serialPort = '/dev/cu.usbmodem1421'; % define COM port #
%Open Serial COM Port
s = serial(serialPort)
fopen(s);
delay = .01; % make sure sample faster than resolution
while 1 %Loop when Plot is Active
dat = fscanf(s,'%f'); %Read Data from Serial as Float
if(~isempty(dat) && isfloat(dat)) %Make sure Data Type is Correct
disp (dat);
end
%Allow MATLAB to Update Plot
pause(delay);
end
%Close Serial COM Port and Delete useless Variables
fclose(s);
clear count dat delay s serialPort;
Tuesday, February 14, 2017
Friday, February 3, 2017
Arduino & MATLAB
Please use the following links to browse through the Arduino & MATLAB resource:
- Arduino Support from MATLAB: https://www.mathworks.com/hardware-support/arduino-matlab.html.
- MATLAB GUI Basics: https://www.youtube.com/playlist?list=PLPhi9dVsEVfZOlbIPsrQx0drJlBX9T15r.
- Plotting in MATLAB: https://www.youtube.com/playlist?list=PLPhi9dVsEVfbNFWBDsgELOuKMob8qIr8S.
Thursday, December 15, 2016
Robot Programming: Line Tracking
Please watch the following VEX Cortex video tutorials to learn the basic concepts of programming, system configuration, motion control, and line tracking.
1. Introduction to
Programming
2.
Wired System Configuration
3. Download Sample
4.
Moving Forward
5.
Speed and Direction
6. Line Tracking
For more information, please
visit the VEX
EDR Video Trainer web site.
Sunday, November 27, 2016
MATLAB Video Tutorials Progress Chart
MATLAB Video Tutorials: Watch the MATLAB tutorials such that you can use this powerful tool to help you solve a wide spectrum of STEM problems. Please use the Progress Chart to document your personal progress in watching the tutorials.
Part I: MATLAB Overview
- MATLAB Overview: Get an overview of MATLAB®, the language of technical computing. (2:05)
- Analyzing and Visualizing Data with MATLAB: Explore, visualize, and model your data with MATLAB®. (3:26)
- Programming and Developing Algorithms with MATLAB: Write programs and develop algorithms using the high-level language and development tools in MATLAB®. (4:32)
- Developing and Deploying Applications with MATLAB: Develop and share MATLAB® applications as code, executables, or software components. (3:51)
- Getting Started with MATLAB: Get started with MATLAB® and learn how to get more information. (7:00)
- Working in The Development Environment: Access tools such as the command history workspace browser and variable editor, save and load your workspace data, and manage windows and desktop layout. (5:21)
- Top Ways to Get Help: Find online support to help solve your toughest problems while using MATLAB® and Simulink® products. (3:20)
- Importing Data from Text Files Interactively: Use the import tool to import numeric and text data from delimited and fixed width text files. Generate MATLAB® code to repeat the process on similar files. (7:01)
- Importing Data from Files Programmatically: Import data from spreadsheets, text files, and other formats into MATLAB® using file I/O functions. (3:55)
- Importing Spreadsheets into MATLAB: Select and load mixed textual and numeric data from spreadsheets interactively then generate the required MATLAB® code. (4:34)
- Using Basic Plotting Functions: Create plots programmatically using basic plotting functions. (5:52)
- Working with Arrays in MATLAB: Create and manipulate MATLAB® arrays, including accessing elements using indexing. (8:17)
- Introducing MATLAB Fundamental Classes (Data Types): Work with numerical, textual, and logical data types. (5:46)
- Introducing Tables and Categorical Arrays: Manage mixed-type tabular data with the table data container, and data from a finite, discrete set of categories with the memory-efficient categorical array. (6:01)
- Introducing Structures and Cell Arrays: Use structures and cell arrays to manage heterogeneous data of different types and sizes. (5:04)
- Writing a MATLAB Program: Write a MATLAB® program, including creating a script and a function. (4:57)
- Publishing MATLAB Code from the Editor: Share your work by publishing MATLAB® code from the MATLAB Editor to HTML and other formats. (5:57)
- Developing Classes Overview: Design classes by defining properties, methods, and events in a class definition file. (10:48)
- Calling MATLAB from C Code: Call MATLAB® from C, C++ or Fortran code using the MATLAB Engine Library. (1:30)
Part II: Computer Programming with MATLAB
Lesson 1: Introduction
1.1 Introduction (11:43)
1.2 The MATLAB Environment (23:03)
1.3 MATLAB Online (27:43)
1.4 MATLAB as a Calculator (14:25)
1.5 Syntax and Semantics (5:01)
1.6 Help (8:37)
1.7 Plotting (19:06)Lesson 2: Matrices and Operators
2.1 Introduction to Matrices and Operators (11:25)
2.2 The Colon Operator (8:45)
2.3 Accessing Parts of a Matrix (21:33)
2.4 Combining and Transforming Matrices (10:06)
2.5 Arithmetic Part 1 (18:07)
2.6 Arithmetic Part 2 (11:52)
2.7 Operator Precedence (13:31)Lesson 3: Functions
3.1 Introductions to Functions (5:39)
3.2 Function I/O (22:15)
3.3 Formal Definition of Functions (2:52)
3.4 Subfunctions (6:17)
3.5 Scope (5:24)
3.6 Advantages of Functions (2:39)
3.7 Scripts (4:27)Lesson 4: Programmer’s Toolbox
4.1 Introduction to programmer’s Toolbox (7:06)
4.2 Matrix Building (15:11)
4.3 Input / Output (20:47)
4.4 Plotting (17:47)
4.5 Debugging (22:17)Lesson 5: Selection
5.1 Selection (11:53)
5.2 If-Statements, continued (8:33)
5.3 Relational and Logical Operators (34:51)
5.4 Nested If-Statements (2:12)
5.5 Variable Number of Function Arguments (6:40)
5.6 Robustness (8:37)
5.7 Persistent Variables (6:54)Lesson 6: Loops
6.1 For-Loops (38:50)
6.2 While-Loops (20:16)
6.3 Break Statement (29:31)
6.4 Logical Indexing (37:29)
6.5 Preallocation (8:59)Lesson 7: Data Types
7.1 Introduction to Data Types (20:27)
7.2 Strings (29:04)
7.3. Structs (14:51)
7.4 Cells (21:47)Lesson 8: File Input/Output
8.1 Introduction to File Input/Output (15:00)
8.2 Excel Files (9:12)
8.3 Text Files (12:17)
8.4 Binary Files (38:55)
Tuesday, October 25, 2016
Thursday, September 29, 2016
How to connect Vex Microcontroller to Vex Joystick
Below is a guide to teach you how to connect Vex Microcontroller to Vex Joystick.
1. Make sure that your Microcontroller is OFF.
2. Using a Vex USB A to A Cable, connect 1 end to the Microcontroller, and the other end to the computer.
3. Turn ON the microcontroller.
4. Open up ROBOTC for Vex Robotics 4.x.
5. Under "View", select ROBOTC preferences and detailed preferences.
6. Then, select "Platform".
7. Click on the drop-down menu that says "Platform Type".
8. Choose "Vex Robotics", then "Vex 2.0 Cortex".
9. Click on "Change Port".
10. Choose the port that says "Vex Robotics Comm Port" and click "OK".
11. Click "Apply" on the ROBOTC preferences window, then click "OK".
12. Under "Robot", choose "VEX Cortex Communication Mode", then "VEXnet or USB".
13. Under "Robot", choose "Platform Type", then "VEX 2.0 Cortex".
14. Under "Robot", choose "Platform Type", then "VEX Robotics", then "VEX 2.0 Cortex".
15. Under "Robot", choose "Download Firmware", then "Automatically Update VEX Cortex".
16. If the Microcontroller is fully updated, acknowledge the pop-up window, if not, continue with the update.
17. Open "VEXnet Upgrade Utility".
18. Next to "Default Code", click the button so that is says "ON".
19. Click "Download Default".
20. Unplug the Microcontroller and turn it OFF.
21. Plug the cable into the VEX joystick. It should be OFF.
22. Under "View", select ROBOTC preferences, and detailed preferences.
23. Then, select "Platform".
24. Select "Change Port"
25. Choose the port that says "Vex Robotics Comm Port" and click "OK".
26. Click "Apply" on the ROBOTC preferences window, then click "OK".
27. Under "Robot", choose "Download Firmware", then "Automatically Update VEXnet Joystick".
28. If the joystick is fully updated, acknowledge the pop-up window, if not, continue with the update.
29. Unplug the joystick
30. Connect the VEXnet Key to both the joystick and the microcontroller, 1 each.
31. Turn them both on and wait a few seconds, until the lights on both devices are green.
32. Congratulations! Now you can control your robot using the VEX joystick!
1. Make sure that your Microcontroller is OFF.
2. Using a Vex USB A to A Cable, connect 1 end to the Microcontroller, and the other end to the computer.
3. Turn ON the microcontroller.
4. Open up ROBOTC for Vex Robotics 4.x.
5. Under "View", select ROBOTC preferences and detailed preferences.
6. Then, select "Platform".
7. Click on the drop-down menu that says "Platform Type".
8. Choose "Vex Robotics", then "Vex 2.0 Cortex".
9. Click on "Change Port".
10. Choose the port that says "Vex Robotics Comm Port" and click "OK".
11. Click "Apply" on the ROBOTC preferences window, then click "OK".
12. Under "Robot", choose "VEX Cortex Communication Mode", then "VEXnet or USB".
13. Under "Robot", choose "Platform Type", then "VEX 2.0 Cortex".
14. Under "Robot", choose "Platform Type", then "VEX Robotics", then "VEX 2.0 Cortex".
15. Under "Robot", choose "Download Firmware", then "Automatically Update VEX Cortex".
16. If the Microcontroller is fully updated, acknowledge the pop-up window, if not, continue with the update.
17. Open "VEXnet Upgrade Utility".
18. Next to "Default Code", click the button so that is says "ON".
19. Click "Download Default".
20. Unplug the Microcontroller and turn it OFF.
21. Plug the cable into the VEX joystick. It should be OFF.
22. Under "View", select ROBOTC preferences, and detailed preferences.
23. Then, select "Platform".
24. Select "Change Port"
25. Choose the port that says "Vex Robotics Comm Port" and click "OK".
26. Click "Apply" on the ROBOTC preferences window, then click "OK".
27. Under "Robot", choose "Download Firmware", then "Automatically Update VEXnet Joystick".
28. If the joystick is fully updated, acknowledge the pop-up window, if not, continue with the update.
29. Unplug the joystick
30. Connect the VEXnet Key to both the joystick and the microcontroller, 1 each.
31. Turn them both on and wait a few seconds, until the lights on both devices are green.
32. Congratulations! Now you can control your robot using the VEX joystick!
Sunday, September 28, 2014
Set Up the Programming Environment
Using the VEX Cortex with ROBOTC
Getting Started with the VEX Cortex Wiki
Subscribe to:
Posts (Atom)
